[OpenSIPS-Users] adding 1 alias to more than one subscriber

Dave Singer dave.dorasinger at gmail.com
Fri May 20 03:14:40 CEST 2011


Toyima,
Not sure how much you know about branches, so...

With that switch branches are added for each alias. By default any
test or action in the rest of the main route script only applies to
the first branch. That is why only the first branch has the lookup
location done to it.
In order to test/act on other branches, you need to use t_on_branch()
and define a route block. When t_on_branch() is set to that route
block it will be run for all branches that were created.
Also of note is that in failure route, the vars like $ru and headers
are all set to the way they were before any branch route is run (may
have an effect on how you failover to voicemail). So consider that
when choosing to apply changes in main routing or branch routing. A
good example is uac_replace_from() which can only be run once on a
message so it is good to put it as one of the last things and if there
are branches, do it in the branch block.
What I've found to work good is to define a named route block to
handle last minute changes and test in main route block if there are
multiple branches. If only main branch, just call the
last_minute_changes from main route before exit; other wise set
t_on_branch() and call last_minute_changes from the branch route
block.

Hope that helps.

Dave

On Thu, May 19, 2011 at 2:58 AM, Toyima Dias <toyimads at gmail.com> wrote:
> Hi Dave,
>
> i've added the line modparam("alias_db", "append_branches", 1), but now i'm
> trying to call the alias 314001 and the INVITE is going to both users 1000
> and 1001 as expected: that's nice...
>
>  #
> U 2011/05/18 13:55:52.918314 192.168.131.129:5060 -> 192.168.131.1:61052
> INVITE sip:vipexamk at 192.168.131.1:61052 SIP/2.0
> Record-Route: <sip:192.168.131.129;lr=on>
> Via: SIP/2.0/UDP 192.168.131.129;branch=z9hG4bKec48.66d63466.0
> Via: SIP/2.0/UDP
> 192.168.131.1:5060;branch=z9hG4bK-d8754z-801d2084170f1b21-1---d8754z-
> Max-Forwards: 69
> Contact: <sip:1000 at 192.168.131.1:5060;transport=UDP>
> To: <sip:314001 at 192.168.131.129;transport=UDP>
> From: "1000"<sip:1000 at 192.168.131.129;transport=UDP>;tag=ff69d424
> Call-ID: N2JiMTRhODJhNTRiNTgzNjc3NjdkZTI1NThiOWQ1MTU.
> CSeq: 2 INVITE
> Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO,
> SUBSCRIBE
> Content-Type: application/sdp
> User-Agent: Zoiper rev.5324
> Content-Length: 329
>
> v=0
> o=Zoiper_user 0 0 IN IP4 192.168.131.1
> s=Zoiper_session
> c=IN IP4 192.168.131.1
> t=0 0
> m=audio 8000 RTP/AVP 3 0 8 110 98 101
> a=rtpmap:3 GSM/8000
> a=rtpmap:0 PCMU/8000
> a=rtpmap:8 PCMA/8000
> a=rtpmap:110 speex/8000
> a=rtpmap:98 iLBC/8000
> a=fmtp:98 mode=30
> a=rtpmap:101 telephone-event/8000
> a=fmtp:101 0-15
> a=sendrecv
>
> #
> U 2011/05/18 13:55:52.918371 192.168.131.129:5060 -> 192.168.131.129:5060
> INVITE sip:1000 at 192.168.131.129 SIP/2.0
> Record-Route: <sip:192.168.131.129;lr=on>
> Via: SIP/2.0/UDP 192.168.131.129;branch=z9hG4bKec48.66d63466.1
> Via: SIP/2.0/UDP
> 192.168.131.1:5060;branch=z9hG4bK-d8754z-801d2084170f1b21-1---d8754z-
> Max-Forwards: 69
> Contact: <sip:1000 at 192.168.131.1:5060;transport=UDP>
> To: <sip:314001 at 192.168.131.129;transport=UDP>
> From: "1000"<sip:1000 at 192.168.131.129;transport=UDP>;tag=ff69d424
> Call-ID: N2JiMTRhODJhNTRiNTgzNjc3NjdkZTI1NThiOWQ1MTU.
> CSeq: 2 INVITE
> Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO,
> SUBSCRIBE
> Content-Type: application/sdp
> User-Agent: Zoiper rev.5324
> Content-Length: 329
>
> v=0
> o=Zoiper_user 0 0 IN IP4 192.168.131.1
> s=Zoiper_session
> c=IN IP4 192.168.131.1
> t=0 0
> m=audio 8000 RTP/AVP 3 0 8 110 98 101
> a=rtpmap:3 GSM/8000
> a=rtpmap:0 PCMU/8000
> a=rtpmap:8 PCMA/8000
> a=rtpmap:110 speex/8000
> a=rtpmap:98 iLBC/8000
> a=fmtp:98 mode=30
> a=rtpmap:101 telephone-event/8000
> a=fmtp:101 0-15
> a=sendrecv
>
> As you can see, the R-URI of the first invite is ok, but not the second, as
> you can see the domain part is the ip address of the proxy and not the ip of
> the location user 1000, what's happening? seems to be a loop on the second
> branch (192.168.131.129:5060 -> 192.168.131.129:5060)...as i can see, the DB
> alias is correctly fetching both users from DB, but only the first one is
> resolved via lookup(location) (registration search).
>
> any suggest?
>
> Many thanks!
>
> 2011/5/18 Dave Singer <dave.dorasinger at gmail.com>
>>
>> Toyima,
>>
>> check:
>> http://www.opensips.org/html/docs/modules/1.6.x/alias_db.html#id250030
>>
>> Dave
>>
>> On Tue, May 17, 2011 at 6:44 AM, Toyima Dias <toyimads at gmail.com> wrote:
>> >
>> > Is it possible to add the same alias to more than one subscriber? for
>> > example, if an incoming call to the number 14882736524 is assigned to
>> > subscriber 1000, is it possible to assign this DID to subscriber 1001? the
>> > idea is to create a group of ringing or something like that, is that
>> > possible? i've tried to insert the data on phpmyadmin and also on
>> > opensips-panel, it doesn't work:
>> >
>> >
>> > Error
>> >
>> > consulta SQL:
>> >
>> > INSERT INTO `opensips`.`dbaliases` (
>> >
>> > `id` ,
>> > `alias_username` ,
>> > `alias_domain` ,
>> > `username` ,
>> > `domain`
>> > )
>> > VALUES (
>> > NULL , '314001', '192.168.131.129', '1000', '192.168.131.129'
>> > )
>> >
>> > MySQL ha dicho:
>> >
>> > #1062 - Duplicate entry '314001-192.168.131.129' for key 'alias_idx'
>> >
>> >
>> > Thanks!
>> >
>> > _______________________________________________
>> > Users mailing list
>> > Users at lists.opensips.org
>> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>> >
>>
>>
>>
>> --
>> David Singer
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>



More information about the Users mailing list