[Spce-user] Diversion headers in SIPWISE 2.6 // Call forwarding

Jon Bonilla (Manwe) jbonilla at sipwise.com
Wed Feb 20 08:01:15 EST 2013


El Wed, 20 Feb 2013 13:44:29 +0100
"Joel Smith | VOZELIA" <joel at vozelia.com> escribió:

> Hi Jon,
> 
> On Mon, Feb 18, 2013 at 2:52 PM, Jon Bonilla <jbonilla at sipwise.com> wrote:
> >
> > El Fri, 15 Feb 2013 03:19:29 +0100
> > "Joel Smith | VOZELIA" <joel at vozelia.com> escribió:
> >
> > > Hi Jon,
> > >
> > > Have you been able to have a look at the code?
> > >
> >
> >
> > There's only one way to validate it: Test it :)
> 
> I've prepared a test-scenario just as you said and everything went perfect.
> 
> >
> > Check what happens in the cdr when you patch the kamailio log file. You
> > scenario is not hard to replicate. You just need a couple of peers, the spce
> > and test normal calls and call with that header.
> >
> 
> I added the following code in the ROUTE_ACC_CALLER:
> 
>         # Vozelia - Gestion de llamadas desviadas
>         if(is_present_hf("P-Charge-Info")) {
>                 $var(cabecera_desvio) = $(hdr(P-Charge-Info));
>                 $var(cabecera_desvio_temp1) =
> $(var(cabecera_desvio){s.select,1,:});
>                 $var(cabecera_desvio_temp2) =
> $(var(cabecera_desvio_temp1){s.select,0,@});
>                 $avp(s:acc_pcharge_user) = "34" +
> $var(cabecera_desvio_temp2);
>                 xlog("L_INFO","Found P-Charge-Info header, setting
> source-user from '$avp(s:acc_caller_user)' to
> '$avp(s:acc_pcharge_user)' - R=$ru ID=$ci\n");
>                 $avp(s:acc_caller_user) = $avp(s:acc_pcharge_user);
>         }
> 
> I'm sure there is a much better way of extracting the user part from
> the complete header, but I'm still getting started with kamailio
> scripting. If anyone can recommend me a better way I'll be very
> grateful. The header looks like this:
> '<sip:602220005 at 217.15.42.158:54237>;npi=UNKNOWN;noa=3' and the useful
> part would be: 602220005
> 
> Said this, after testing, I have this in the log:
> 
> Feb 20 13:27:47 SIPWISE02 /usr/sbin/kamailio[11684]: INFO: <script>:
> Found P-Charge-Info header, setting source-user from '34661407594' to
> '34602220005' - R=sip:34665801225 at 37.139.122.7:5060;transport=udp
> ID=32a3-4bf-1202013121947-IMG01-0-192.168.80.21
> 
> And this is how the CDR of that call is generated:
> 
> '220','2013-02-20
> 13:28:31','0','4','','','','0','34602220005','217.15.42.158','34661407594','0','0','4','','','','','0','37.139.122.7','34665801225','37.139.120.151','','','call','ok','200','2013-02-20
> 13:27:48.767','2013-02-20
> 13:27:56.740','28.820','32a3-4bf-1202013121947-IMG01-0-192.168.80.21','ok','2013-02-20
> 13:28:31','0.00','0.00','onnet','','platform
> internal','','34665801225','0','0'
> 
> The source_user has been correctly changed due to the hack in the
> route, and the source_cli is unchanged, so now identifying forwarded
> calls is an easy task.
> 
> If anyone has do deal with the "P-Charge-Info" header at least this
> will be a good help to start with.
> 
> Thank you all for your help.
> 



Thanks for explaining you solution and sharing it with the community Joel.

We will talk about adding a "custom" or "userfield" field to the cdr to let
people put their custom info. 



cheers,

Jon

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.sipwise.com/pipermail/spce-user_lists.sipwise.com/attachments/20130220/5252c2a5/attachment-0001.asc>


More information about the Spce-user mailing list