Hi guys,
I'm having a weird situation when trying to modify some parts of the RPID on my config file. I'm using Kamailio 1.5.3-notls
The code is the following:
... subst('/^Remote-Party-ID:(.*)sip:(.*)@(.*)$/Remote-Party-ID:\1sip:$avp(s:ANIegress)@\3/ig'); subst('/^Remote-Party-ID:(.*)"(.*)"(.*)sip:(.*)$/Remote-Party-ID:\1"$avp(s:ANIegress)"\3sip:\4/ig'); ...
With the first line I'm trying, to change the user part of the SIP-URI to the value in $avp(s:ANIegress). Then i just replace the token between double quotes (if any) with the value in $avp(s:ANIegress).
But when I check the captured (ngrep) results I have the following:
Before: Remote-Party-ID: "60911000" sip:541160911100@192.168.200.100;privacy=off;screen=no. After: Remote-Party-ID: "60911000" sip:1160911100@192.168.200.100;privacy=off;screen=no.Remote-Party-ID: "1160911100" sip:541160911100@192.168.200.100;privacy=off;screen=no.
Can anyone point me on the direction to solve the issue, or a better way to replace the values in RPID, PAI (and possibly From Header for some providers)?
Thanks in advence! Uriel
Uriel,
Why not simplify the matter?
1. Extract the value(s) of the existing Remote-Party-ID header using $re.
Or, if you need something other than the RPID URI, some transformation applied to $hdr(Remote-Party-ID).
2. remove_hf("Remote-Party-ID");
3. append_hf("Remote-Party-ID: <whatever you like!>");
:)
On 08/11/2010 02:00 PM, Uriel Rozenbaum wrote:
Hi guys,
I'm having a weird situation when trying to modify some parts of the RPID on my config file. I'm using Kamailio 1.5.3-notls
The code is the following:
... subst('/^Remote-Party-ID:(.*)sip:(.*)@(.*)$/Remote-Party-ID:\1sip:$avp(s:ANIegress)@\3/ig'); subst('/^Remote-Party-ID:(.*)"(.*)"(.*)sip:(.*)$/Remote-Party-ID:\1"$avp(s:ANIegress)"\3sip:\4/ig'); ...
With the first line I'm trying, to change the user part of the SIP-URI to the value in $avp(s:ANIegress). Then i just replace the token between double quotes (if any) with the value in $avp(s:ANIegress).
But when I check the captured (ngrep) results I have the following:
Before: Remote-Party-ID: "60911000" sip:541160911100@192.168.200.100;privacy=off;screen=no. After: Remote-Party-ID: "60911000" sip:1160911100@192.168.200.100;privacy=off;screen=no.Remote-Party-ID: "1160911100"sip:541160911100@192.168.200.100;privacy=off;screen=no.
Can anyone point me on the direction to solve the issue, or a better way to replace the values in RPID, PAI (and possibly From Header for some providers)?
Thanks in advence! Uriel
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
Alex,
Takes a little more work but works perfectly. Thanks!!!
I have to be aware of calls that have 2 RPID headers (party=called and party=calling), is you're interested I can paste the code once I'm done coding and testisng. :)
Rgds, Uriel
On Wed, Aug 11, 2010 at 6:41 PM, Alex Balashov abalashov@evaristesys.com wrote:
Uriel,
Why not simplify the matter?
- Extract the value(s) of the existing Remote-Party-ID header using $re.
Or, if you need something other than the RPID URI, some transformation applied to $hdr(Remote-Party-ID).
remove_hf("Remote-Party-ID");
append_hf("Remote-Party-ID: <whatever you like!>");
:)
On 08/11/2010 02:00 PM, Uriel Rozenbaum wrote:
Hi guys,
I'm having a weird situation when trying to modify some parts of the RPID on my config file. I'm using Kamailio 1.5.3-notls
The code is the following:
...
subst('/^Remote-Party-ID:(.*)sip:(.*)@(.*)$/Remote-Party-ID:\1sip:$avp(s:ANIegress)@\3/ig');
subst('/^Remote-Party-ID:(.*)"(.*)"(.*)sip:(.*)$/Remote-Party-ID:\1"$avp(s:ANIegress)"\3sip:\4/ig'); ...
With the first line I'm trying, to change the user part of the SIP-URI to the value in $avp(s:ANIegress). Then i just replace the token between double quotes (if any) with the value in $avp(s:ANIegress).
But when I check the captured (ngrep) results I have the following:
Before: Remote-Party-ID: "60911000" sip:541160911100@192.168.200.100;privacy=off;screen=no. After: Remote-Party-ID: "60911000" sip:1160911100@192.168.200.100;privacy=off;screen=no.Remote-Party-ID: "1160911100"sip:541160911100@192.168.200.100;privacy=off;screen=no.
Can anyone point me on the direction to solve the issue, or a better way to replace the values in RPID, PAI (and possibly From Header for some providers)?
Thanks in advence! Uriel
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
-- Alex Balashov - Principal Evariste Systems LLC 1170 Peachtree Street 12th Floor, Suite 1200 Atlanta, GA 30309 Tel: +1-678-954-0670 Fax: +1-404-961-1892 Web: http://www.evaristesys.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
On 08/12/2010 05:27 PM, Uriel Rozenbaum wrote:
Takes a little more work but works perfectly. Thanks!!!
Yes, but a lot easier to read, understand and modify from a code and business process management perspective.
I have to be aware of calls that have 2 RPID headers (party=called and party=calling), is you're interested I can paste the code once I'm done coding and testisng. :)
Sure, example code is always good for posterity.
Here it comes.
Fell free to make any notations, we are all here to improve the matter:
# From Edition if (is_present_hf("From")) { $avp(s:newFrom) = $avp(s:ANIegress) + " <sip:" + $avp(s:ANIegress) + "@" + $(hdr(From){tobody.host}) + ">;" + $(hdr(From){tobody.params}); remove_hf("From"); insert_hf("From: $avp(s:newFrom)\r\n", "Contact");
}
# Remote-Party-ID manipulation if (is_present_hf("Remote-Party-ID")) { # 1 or 2 RPID headers? if($(hdr(Remote-Party-ID)[0]{s.len}) != $(hdr(Remote-Party-ID)[*]{s.len})) { if($(hdr(Remote-Party-ID)[0]{tobody.params}{param.value,party}) == "calling") { $avp(s:newRPID) = $avp(s:ANIegress) + " <sip:" + $avp(s:ANIegress) + "@" + $(hdr(Remote-Party-ID)[0]{tobody.host}) + ">;" + $(hdr(Remote-Party-ID)[0]{tobody.params}); $avp(s:oldRPID) = $(hdr(Remote-Party-ID)[0]); $avp(s:otherRPID) = $(hdr(Remote-Party-ID)[1]); } else { $avp(s:newRPID) = $avp(s:ANIegress) + " <sip:" + $avp(s:ANIegress) + "@" + $(hdr(Remote-Party-ID)[1]{tobody.host}) + ">;" + $(hdr(Remote-Party-ID)[1]{tobody.params}); $avp(s:oldRPID) = $(hdr(Remote-Party-ID)[1]); $avp(s:otherRPID) = $(hdr(Remote-Party-ID)[0]); } remove_hf("Remote-Party-ID"); append_hf("Remote-Party-ID: $avp(s:newRPID)\r\n", "Allow"); append_hf("Remote-Party-ID: $avp(s:otherRPID)\r\n", "Remote-Party-ID"); } else { $avp(s:newRPID) = $avp(s:ANIegress) + " <sip:" + $avp(s:ANIegress) + "@" + $(hdr(Remote-Party-ID){tobody.host}) + ">;" + $(hdr(Remote-Party-ID){tobody.params}); $avp(s:oldRPID) = $(hdr(Remote-Party-ID)); remove_hf("Remote-Party-ID"); append_hf("Remote-Party-ID: $avp(s:newRPID)\r\n", "Allow"); } }
# P-Asserted-Identity manipulation if (is_present_hf("P-Asserted-Identity")) {
if($avp(s:paiMODE) == "Tel-URI") { $avp(s:newPAI) = "<tel:" + $avp(s:ANIegress) + ">"; $avp(s:oldPAI) = $(hdr(P-Asserted-Identity)); } else if($avp(s:paiMODE) == "SIP-URI") { $avp(s:newPAI) = $avp(s:ANIegress) + " <sip:" + $avp(s:ANIegress) + "@" + $(hdr(P-Asserted-Identity){tobody.host}) + ">"; $avp(s:oldPAI) = $(hdr(P-Asserted-Identity)); } remove_hf("P-Asserted-Identity"); append_hf("P-Asserted-Identity: $avp(s:newPAI)\r\n", "Privacy"); }
Cheers, Uriel
On Thu, Aug 12, 2010 at 6:29 PM, Alex Balashov abalashov@evaristesys.com wrote:
On 08/12/2010 05:27 PM, Uriel Rozenbaum wrote:
Takes a little more work but works perfectly. Thanks!!!
Yes, but a lot easier to read, understand and modify from a code and business process management perspective.
I have to be aware of calls that have 2 RPID headers (party=called and party=calling), is you're interested I can paste the code once I'm done coding and testisng. :)
Sure, example code is always good for posterity.
-- Alex Balashov - Principal Evariste Systems LLC 1170 Peachtree Street 12th Floor, Suite 1200 Atlanta, GA 30309 Tel: +1-678-954-0670 Fax: +1-404-961-1892 Web: http://www.evaristesys.com/
On Friday 13 August 2010, Uriel Rozenbaum wrote:
[..]
Hello Uriel,
just noticed one small thing:
$avp(s:oldPAI) = $(hdr(P-Asserted-Identity));
There is some shortcut PVs for this header, i think its $pa. Maybe its a bit cleaner this way. I did not checked, but maybe there is also one for remote- party-ID which you use as well.
Cheers,
Henning
Hi Henning,
I'll try using $pa if it is available. With $re I vave the issue on some gateways that send 2 RPID headers (one for called and other for caiiling party).
Cheers, Uriel
On Fri, Aug 13, 2010 at 1:16 PM, Henning Westerholt henning.westerholt@1und1.de wrote:
On Friday 13 August 2010, Uriel Rozenbaum wrote:
[..]
Hello Uriel,
just noticed one small thing:
$avp(s:oldPAI) = $(hdr(P-Asserted-Identity));
There is some shortcut PVs for this header, i think its $pa. Maybe its a bit cleaner this way. I did not checked, but maybe there is also one for remote- party-ID which you use as well.
Cheers,
Henning