Hello,
we ran into a trouble with sharing variable into reply route...
We are going to match asterisk's uniqueid with rtpengine records like this:
route[from_asterisk]{ $var(UniqueId)=$hdr(X-UniqueId); $var(rtp_flags) = $var(rtp_flags) + " label={uid:$var(UniqueId),stream:outgoing} record-call=on";
rtpengine_manage($var(rtp_flags)); }
reply_route[from_pstn]{ rtpengine_manage("replace-origin replace-session-connection ICE=remove RTP/AVP rtcp-mux-demux label={uid:$var(UniqueId),stream:outgoing"); } and it doesn't work... The one possible way what we found its using $shv instead of $var... But its unsecure way, cuz it may confus our bussines logic...
Do you have any idea how to implement this? Many thanks!
Hello ! $var is per worker and not shared among workers
I think you can use $avp or $dlg_var !
Cheers
Paolo
Il giorno lun 9 set 2019 alle 22:44 Zhan Bazarov chiefkeeft@gmail.com ha scritto:
Hello,
we ran into a trouble with sharing variable into reply route...
We are going to match asterisk's uniqueid with rtpengine records like this:
route[from_asterisk]{ $var(UniqueId)=$hdr(X-UniqueId); $var(rtp_flags) = $var(rtp_flags) + " label={uid:$var(UniqueId),stream:outgoing} record-call=on";
rtpengine_manage($var(rtp_flags)); }
reply_route[from_pstn]{ rtpengine_manage("replace-origin replace-session-connection ICE=remove RTP/AVP rtcp-mux-demux label={uid:$var(UniqueId),stream:outgoing"); } and it doesn't work... The one possible way what we found its using $shv instead of $var... But its unsecure way, cuz it may confus our bussines logic...
Do you have any idea how to implement this? Many thanks! _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello Zhan,
$var()s are ephemeral variables intended for use only in the context of processing a single SIP message. Also, they live in the private memory ("package memory") of a single SIP worker process.
Requests (route) and replies (onreply_route) are different kinds of messages, and moreover, they are very likely to be handled by different child processes. So, a $var set in a request route isn't going to show up in an onreply_route. Furthermore, $vars have a global scope and aren't individuated to a given SIP message flow (i.e. a transaction).
What you want is to use AVPs:
https://www.kamailio.org/wiki/cookbooks/5.2.x/pseudovariables#avp_id_-_avps
Or their nonscalar cousin, XAVPs.
Either way, these are explicitly transaction-persistent, so they will be visible from any route that touches a message associated with the transaction in which they were set. Just use this instead:
$avp(UniqueId) = $hdr(X-UniqueId);
and I think you'll get the behaviour you expect.
-- Alex
On Mon, Sep 09, 2019 at 11:43:27PM +0300, Zhan Bazarov wrote:
Hello,
we ran into a trouble with sharing variable into reply route...
We are going to match asterisk's uniqueid with rtpengine records like this:
route[from_asterisk]{ $var(UniqueId)=$hdr(X-UniqueId); $var(rtp_flags) = $var(rtp_flags) + " label={uid:$var(UniqueId),stream:outgoing} record-call=on";
rtpengine_manage($var(rtp_flags)); }
reply_route[from_pstn]{ rtpengine_manage("replace-origin replace-session-connection ICE=remove RTP/AVP rtcp-mux-demux label={uid:$var(UniqueId),stream:outgoing"); } and it doesn't work... The one possible way what we found its using $shv instead of $var... But its unsecure way, cuz it may confus our bussines logic...
Do you have any idea how to implement this? Many thanks!
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users