[SR-Users] reg_fetch_contacts for multiple devices registered
Daniel-Constantin Mierla
miconda at gmail.com
Wed May 14 21:25:15 CEST 2014
append_branch() works in 4.0 if you need to add additional branches.
Look at default config file to see an example of using branch_route.
Cheers,
Daniel
On 14/05/14 17:54, Jonathan Hunter wrote:
> Hi Daniel,
>
> Sorry to bug you just wondered if had a chance to consider the
> branching question?
>
> Main thing is does append_branch work on 4.0 ?
>
> And also the best way to implement branch routes?
>
> Thanks
>
> Jon
>
>
>
>
>
>
> Hello,
>
> I am getting there!
>
> I am not using a branch routing block at present, I am doing
> modifications using values I pull from the location table.
>
> So my question may be slightly different but very much branch related.
>
> So I have two contacts;
>
>
> Contact::
> <sip:1009 at 213.123.211.158:15060;transport=udp;registering_acc=91_208_141_34>;q=;expires=60;flags=0x0;cflags=0x0;state=1;socket=<udp:xx.xx.xx.xx:5060>;methods=0xFFFFFFFF;user_agent=<Contact1>;reg-id=0
> Contact::
> <sip:1009 at 213.123.211.158:5061;transport=udp>;q=;expires=3191;flags=0x0;cflags=0xC0;state=1;socket=<udp:xx.xx.xx.xx:5060>;methods=0xFFFFFFFF;received=<sip:213.123.211.158:49827>;user_agent=<Contact2>;+sip.instance=<urn:uuid:00000000-0000-0000-0000-58bfea20a6bd>;reg-id=0
>
> Then using reg_fetch_contacts I get for each registered contact;
>
> xlog("callee=>user_agent: $(ulc(callee=>user_agent)[$var(i)])\n");
> xlog("callee=>received: $(ulc(callee=>received)[$var(i)])\n");
> xlog("callee=>addr1: $(ulc(callee=>addr)[$var(i)])\n");
>
> And define some variables as a result for each contact;
>
> $var(ua1) = $(ulc(callee=>user_agent)[$var(i)]);
> $var(ua1add) = $(ulc(callee=>received)[$var(i)]);
> $var(ua1aor) = $(ulc(callee=>addr)[$var(i)]);
>
>
> I then use these to set $du and $ru in the main routing, I do this
> for contact2 above, so I send to the recieved port (49827),
> identifying this by user agent type.
>
> This works fine however branch[0] was sending an INVITE TO
> 1009 at 213.123.211.158:5061, contact2 also, and not contact1 (port
> 15060), so I have added;
>
> $(branch(dst_uri)[0]) = $var(ua1aor);
>
> So I now get parallel forking as follows;
>
> INVITE sip:1009- at 213.123.211.158:49827 < This is what I want, for
> Contact2
> INVITE sip:1009- at 213.123.211.158:15060 < Again routes to Contact1
> after modifiying the branch parameter.
> INVITE sip:1009- at 213.123.211.158:5061 < Still sends out original
> branch value.
>
>
> And can see from debug, my branch [0] is modifed, but branch [1] is
> also created;
>
> new branch [0] to sip:1009 at 213.123.211.158:49827
> new branch [1] to sip:1009 at 213.123.211.158:5061
>
> So I now have 3 invites for 2 devices.
>
> Whats the best approach to clean this up or implement in the first
> place, my main question is probably around branch modification/control.
>
> Thanks, sorry for long question.
>
> Jon
>
>
> ------------------------------------------------------------------------
> Date: Tue, 13 May 2014 16:04:21 +0200
> From: miconda at gmail.com
> To: sr-users at lists.sip-router.org
> Subject: Re: [SR-Users] reg_fetch_contacts for multiple devices registered
>
> Hello,
>
> are you using a branch_route block?
>
> Cheers,
> Daniel
>
> On 13/05/14 13:28, Jonathan Hunter wrote:
>
>
>
> Hi Guys,
>
> Following on from my initial query, I have indexing working for
> reg_fetch_contacts, however now I am
> having issues with branching.
>
> First, is append_branches() still applicable to kamailio 4.0.6 ?
> As when I use its not recognised.
>
> Also I have two contacts registered, contact 0 and contact 1.
>
> Contact 0 was registered first, then contact 1.
>
> Now I perform manipulation on the main branch after identifying
> the user agent for contact 1, and the main
> branch request is sent out as I wish, this uses branch [0] when
> running debug to the $ru/$du I have modified.
>
> However with branch [1] this isnt modified which is fine, but uses
> the contact AOR from Contact 1 and not Contact 0.
>
> Is this normal behaviour and I just need to improve my logic?
>
> Any advise on parallel branching where you extract certain
> credentials from location table, then as a result
> manipulate the $ru and $du as a result, but dont affect any other
> multiple registrations that would be great!
>
> Many thanks
>
> Jon
>
>
>
> Hi Guys,
>
> I was wondering if anyone could help?
>
> I am currently using reg_fetch_contacts to manipulate signaling
> based on the user agent device being used, therefore I use the
> result of;
>
> if(reg_fetch_contacts("location", "$ru", "callee"))
> {
> xlog("callee=>user_agent $ulc(callee=>user_agent)\n");
> }
>
>
> I then use $ulc(callee=>user_agent) to make routing decisions.
>
> This seems to only return the user-agent device being used for the
> first registration at that AOR, as I have two devices registered,
> a Cisco, and a jitsi client, and it only returns the user_agent of
> the jitsi client I registered first.
>
> Is it possible to return the user agents of all the devices
> registered against an AOR so I can manage decisions accordingly?
>
> Many thanks
>
> Jon
>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org <mailto:sr-users at 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://twitter.com/#%21/miconda> -http://www.linkedin.com/in/miconda
>
> _______________________________________________ SIP Express Router
> (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
> _______________________________________________ SIP Express Router
> (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140514/5d6fc366/attachment.html>
More information about the sr-users
mailing list