Bonjour,
I have a SIP trunk that I’ve been freshly delivered…. But I’m struggling to connect my asterisk on it…
I’ve read that I should create a dedicated endpoint with and outbound-route to enable my communication to go through another distant sip server.
So I tried that naming my endpoint with the dedicated number (I tried to hide my credentials in the sample but I obviously wrote them in my conf).
/etc/astersik/pjsip.conf :
**[general]** type=global endpoint_identifier_order = header,auth_username **[transport-udp]** type=transport protocol=udp ;udp,tcp,tls,ws,wss,flow bind=0.0.0.0:5060 local_net=************ local_net=************** local_net=XXX.XXX.XXX.XXX/XX external_media_address=XXX.XXX.XXX.XXX/XX external_signaling_address=XXX.XXX.XXX.XXX/XX **[594594140950]** type=auth auth_type=userpass username=************* password=************* **[594594140950]** type=aor max_contacts=1 remove_existing=yes contact=sip:...........eu **[594594140950]** type=registration server_uri=sip:………... client_uri=sip::………... contact_user=:……… outbound_auth=594594140950 transport=transport-udp **[594594140950]** type=outbound-route endpoint=594594140950
The dial plan is setted like that in /etc/asterisk/extensions.conf. We want to differentiate number starting by O or + to route them on the trunk sip number :
**[general]** exten => _X.,1,NoOp(General context call to ${EXTEN}) same => n,Dial(PJSIP/${EXTEN}) same => n,Hangup() **[594594140950]** exten => _X.,1,NoOp(Received call from trunk to ${EXTEN}) same => n,Dial(PJSIP/vromain) same => n,Hangup() **[assistance]** exten => _X.,1,NoOp(Typed call to ${EXTEN}) same => n,Set(EXTENSION=${EXTEN}) ; Stocker l'extension dans une variable de canal same => n,GotoIf($["${EXTENSION:0:1}" = "0" | "${EXTENSION:0:1}" = "+" ]?external,1) same => n,Goto(internal,${EXTENSION},1) same => n,Hangup() exten => external,1,NoOp(Number is long enough: ${EXTENSION} ! Processing external call...) same => n,Dial(PJSIP/594594140950/${EXTENSION}) same => n,Hangup() exten => internal,1,NoOp(Number is short : ${EXTENSION}. Processing internal call...) same => n,Goto(general,${EXTENSION},1) same => n,Hangup() exten => contact,1,NoOp(Initiated internal call to ${EXTEN}) same => n,Dial(PJSIP/contact) same => n,Hangup() exten => jandrena,1,NoOp(Initiated internal call to ${EXTEN}) same => n,Dial(PJSIP/jandrena) same => n,Hangup() exten => vromain,1,NoOp(Initiated internal call to ${EXTEN}) same => n,Dial(PJSIP/vromain) same => n,Hangup()
When I try to call an external number it say :
**--** Executing [0594272000@assistance:1] **NoOp**("**PJSIP/vromain-00000001**", "**Typed call to 0594272000**") in new stack **--** Executing [0594272000@assistance:2] **Set**("**PJSIP/vromain-00000001**", "**EXTENSION=0594272000**") in new stack **--** Executing [0594272000@assistance:3] **GotoIf**("**PJSIP/vromain-00000001**", "**1?external,1**") in new stack **--** Goto (assistance,external,1) **--** Executing [external@assistance:1] **NoOp**("**PJSIP/vromain-00000001**", "**Number is long enough: 0594272000 ! Processing external call...**") in new stack **--** Executing [external@assistance:2] **Dial**("**PJSIP/vromain-00000001**", "**PJSIP/594594140950/0594272000**") in new stack [Sep 3 21:18:40] **ERROR**[46730]: **res_pjsip.c**:**993** **ast_sip_create_dialog_uac**: Endpoint '594594140950': Could not create dialog to invalid URI '0594272000'. Is endpoint registered and reachable? [Sep 3 21:18:40] **ERROR**[46730]: **chan_pjsip.c**:**2698** **request**: Failed to create outgoing session to endpoint '594594140950' [Sep 3 21:18:40] **NOTICE**[46877][C-00000002]: **app_dial.c**:**2766** **dial_exec_full**: Unable to create channel of type 'PJSIP' (cause 3 - No route to destination) **==** Everyone is busy/congested at this time (1:0/0/1) **--** Executing [external@assistance:3] **Hangup**("**PJSIP/vromain-00000001**", "") in new stack **==** Spawn extension (assistance, external, 3) exited non-zero on 'PJSIP/vromain-00000001'
And if I use the full number like +594594123456 it say :
NOTICE[46730]: res_pjsip_session.c:4041 new_invite: vromain: Call (UDP:10.10.10.249:55071) to extension ‘+594594272200’ rejected because extension not found in context ‘assistance’.
Which I don’t understand because I thaught that it would act the same as when you use 0594 as it both go to the external extension.
Can someone help me to understand please ?