Hi all
I need to extract a part of the INVITE msg:
INVITE sip:+41796159999@82.197.185.185;user=CSC10824 SIP/2.0
I need 10824 in a avp variable.
Is there a regex function where I can extract this? Or how can this be done?
Something like: Avp(myCSC) = string after CSC - length 5 Please be aware, that ip and destination number in the invite can change ... Otherwise substring would be a solution.
Thanks for help Oli
Hello,
try:
$(ru{uri.param,user}{s.substr,3,0})
Cheers, Daniel
On 11/13/13 12:13 PM, Oliver Roth wrote:
Hi all
I need to extract a part of the INVITE msg:
INVITE sip:+41796159999@82.197.185.185;user=CSC10824 SIP/2.0
I need
10824
in a avp variable.
Is there a regex function where I can extract this? Or how can this be done?
Something like:
Avp(myCSC) = string after CSC -- length 5
Please be aware, that ip and destination number in the invite can change ...
Otherwise substring would be a solution.
Thanks for help
Oli
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hi, have a look at Kamailio transformation:
http://www.kamailio.org/wiki/cookbooks/4.0.x/transformations#uri_transformat...
Daniel
On 11/13/2013 12:19 PM, Daniel-Constantin Mierla wrote:
Hello,
try:
$(ru{uri.param,user}{s.substr,3,0})
Cheers, Daniel
On 11/13/13 12:13 PM, Oliver Roth wrote:
Hi all
I need to extract a part of the INVITE msg:
INVITE sip:+41796159999@82.197.185.185;user=CSC10824 SIP/2.0
I need
10824
in a avp variable.
Is there a regex function where I can extract this? Or how can this be done?
Something like:
Avp(myCSC) = string after CSC – length 5
Please be aware, that ip and destination number in the invite can change …
Otherwise substring would be a solution.
Thanks for help
Oli
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla - http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio Advanced Trainings - Berlin, Nov 25-28
- more details about Kamailio trainings at http://www.asipto.com -
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hi Oli,
On 11/13/2013 06:13 AM, Oliver Roth wrote:
Hi all
I need to extract a part of the INVITE msg:
INVITE sip:+41796159999@82.197.185.185;user=CSC10824 SIP/2.0
I need
10824
in a avp variable.
Hi Oli,
The string you are operating on is called the Request URI, which is exposed by the $ru pseudovariable. The best way to extract it is to use the transformations[1] specifically for extracting URI parameters, which is what 'phone' is:
$avp(user_id) = $(ru{uri.param,user});
If you want '10824' rather than CSC, you can extract a substring:
$avp(user_id) = $(ru{uri.param,user}{s.substr,3,0});
-- Alex
[1] Operations on strings and message parts:
http://www.kamailio.org/wiki/cookbooks/4.0.x/transformations