PJSIP confusion

Hi,

In pjsip.conf I have:

[NUMBER2]
type=registration
outbound_auth=NUMBER2
server_uri=sip:xxxx.fr.sip.ovh
client_uri=sip:NUMBER2@xxxx.fr.sip.ovh
retry_interval=5
fatal_retry_interval=5
forbidden_retry_interval=20
;auth_rejection_permanent=yes

[NUMBER2]
type=auth
auth_type=userpass
password=pppp2
username=NUMBER2
;keep_alive_interval=20

[NUMBER2]
type=aor
contact=sip:xxxx.fr.sip.ovh:5060
max_contacts=1
qualify_frequency=20
qualify_timeout=5

[NUMBER2]
type=endpoint
context=incoming_NUMBER2
disallow=all
allow=alaw,ulaw;,slin,gsm,g729,g723
;g711_b=64
outbound_auth=NUMBER2
aors=NUMBER2
direct_media=yes
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
ice_support=yes
media_use_received_transport=yes

[NUMBER2]
type=identify
endpoint=NUMBER2
match=xxxx.fr.sip.ovh

and

[NUMBER1]
type=registration
outbound_auth=NUMBER1
server_uri=sip:xxxx.fr.sip.ovh
client_uri=sip:NUMBER1@xxxx.fr.sip.ovh
retry_interval=5
fatal_retry_interval=5
forbidden_retry_interval=20
;auth_rejection_permanent=yes

[NUMBER1]
type=auth
auth_type=userpass
password=pppp1
username=NUMBER1
;keep_alive_interval=20

[NUMBER1]
type=aor
contact=sip:xxx.fr.sip.ovh:5060
max_contacts=1
qualify_frequency=20
qualify_timeout=5

[NUMBER1]
type=endpoint
context=incoming_NUMBER1
disallow=all
allow=alaw,ulaw;,slin,gsm,g729,g723
;g711_b=64
outbound_auth=NUMBER1
aors=NUMBER1
direct_media=yes
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
ice_support=yes
media_use_received_transport=yes

[NUMBER1]
type=identify
endpoint=NUMBER1
match=xxxx.fr.sip.ovh

then the contexts are:

[incoming_NUMBER1]
exten => s,1,Stasis(externalMedia1)
[incoming_NUMBER2]
exten => s,1,Stasis(externalMedia2)

Then, if someone calls NUMBER1 he will be redirected to externalMedia1 and if someone calls NUMBER2 he will be redirected to externalMedia2

The 2 numbers are from OVH with a different username and a different password

In the reallity, if someone calls NUMBER1 or NUMBER2 he will be redirected to externalMedia2

and if I change the contexts to router for the 2 numbers like this:

[router]
exten => s,1,NoOp(Numéro appelé : ${EXTEN})

if I call NUMBER1 I see:

 -- Executing [s@router:1] NoOp("PJSIP/NUMBER2-00000003", "Numéro appelé : s") in new stack
    -- Auto fallthrough, channel 'PJSIP/NUMBER2-00000003' status is 'UNKNOWN'

if I call NUMBER2 I see:

 -- Executing [s@router:1] NoOp("PJSIP/NUMBER2-00000004", "Numéro appelé : s") in new stack
    -- Auto fallthrough, channel 'PJSIP/NUMBER2-00000004' status is 'UNKNOWN'

Someone can help me?

thanks?

You can’t have two identify configurations trying to identify the same thing. That won’t work, because it identifies based on the source IP address (and optionally port) so it can’t differentiate. If line support[1] works then that could differentiate, otherwise you would need to use a single endpoint coming in and see if you could differentiate in the dialplan based on stuff in the INVITE request, or potentially see if contact_user works on the outbound registration.

[1] The PJSIP Outbound Registration 'line' Option ⋆ Asterisk

Thanks a lot!
I added contact_user in the registration and the endpoint section, and in the dialplan I modified to:

[router]
exten => NUMBER1,1,GotoIf($["${EXTEN}" = NUMBER1"]?incoming_NUMBER1,${EXTEN},1)

exten => NUMBER2,1,GotoIf($["${EXTEN}" = "NUMBER2"]?incoming_NUMBER2,${EXTEN},1)

and then it works

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.