[OpenSIPS-Users] Odd URI formatting issue when using Exec to return a variable
Bogdan-Andrei Iancu
bogdan at opensips.org
Wed Nov 15 07:29:53 UTC 2023
Hi Ben,
Could you post the xlog output and the resulting 302 ? Also be sure you
are using the latest 3.2 version - please post the `opensips -V` here.
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
https://www.opensips-solutions.com
https://www.siphub.com
On 11/14/23 4:00 PM, Ben Bliss wrote:
>
> I am using Opensips v.3.2 and I am attempting to replicate the 302
> redirect outlined on the blog
> (https://blog.opensips.org/2018/07/05/handling-sip-redirect-requests-in-realtime/
> <https://blog.opensips.org/2018/07/05/handling-sip-redirect-requests-in-realtime/>),
> but am running into an odd issue.
>
> I am using exec to execute an external program, which returns a URI as
> a variable, which is then used to populate the $branch field, which is
> then returned as the contact URI in the 302 response.
>
> For reasons I cannot explain, even though the URI is correctly
> formatted in the xlogs which I print off during the call request, when
> the 302 message is received, the Contact URI is missing the end
> ‘>‘character. This means the server the 302 is being sent to doesn’t
> ACK the message, as the contact URI is invalid.
>
> If I specify the URI directly within OpenSIPs, then the contact header
> is then formatted correctly.
>
> Initially I thought the issue was related to the script returning the
> variable (bash script), so I swapped to a Golang program, essentially
> returning the same URI, but the same behaviour occurs with this as well.
>
> The script is setup as follows…
>
> if ( $si == '10.10.14.71' && is_method("INVITE") ) {
>
> exec("/usr/local/bin/sbc-route", $tU, $var(out));
>
> xlog("Value returned from Re-direct Script is
> $var(out)");
>
> $branch = $var(out);
>
> xlog("Target is set as $branch");
>
> send_reply(302, "Server Redirect");
>
> exit;
>
> }
>
> Can anyone offer any ideas as to why this may be occurring?
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20231115/2e451935/attachment.html>
More information about the Users
mailing list