UK Outbound rule using E.164 format

Hey there

i’d like users to dial 9 to get an outside line
reading the instuctions of my sip provider they require the format to be E.164

eg
phone number: 07955931634
freepbx translated: 447955931634

attached is what i thought would match the patter: 907955931634 , remove the 90, and add 44 sending 447955931634 to the trunk.

Remove the 90 from the final field so it’s just X’s. The ‘match pattern’ field is for dialed digits that are unchanged.

i get a message saying it’s busy

here’s my log
[2020-06-17 13:14:21] VERBOSE[30434][C-00000001] pbx.c: Executing [907950931734@from-internal:13] Macro(“PJSIP/90501-00000000”, “outisbusy,”) in new stack
[2020-06-17 13:14:21] VERBOSE[30434][C-00000001] pbx.c: Executing [s@macro-outisbusy:1] Progress(“PJSIP/90501-00000000”, “”) in new stack
[2020-06-17 13:14:21] VERBOSE[30434][C-00000001] pbx.c: Executing [s@macro-outisbusy:2] GotoIf(“PJSIP/90501-00000000”, “0?emergency,1”) in new stack
[2020-06-17 13:14:21] VERBOSE[30434][C-00000001] pbx.c: Executing [s@macro-outisbusy:3] GotoIf(“PJSIP/90501-00000000”, “0?intracompany,1”) in new stack
[2020-06-17 13:14:21] VERBOSE[30434][C-00000001] pbx.c: Executing [s@macro-outisbusy:4] Playback(“PJSIP/90501-00000000”, “all-circuits-busy-now&please-try-call-later, noanswer”) in new stack
[2020-06-17 13:14:21] ERROR[8825] pjproject: icess0x7f992c019ca8 …Error sending STUN request: Network is unreachable
[2020-06-17 13:14:21] VERBOSE[30434][C-00000001] file.c: <PJSIP/90501-00000000> Playing ‘all-circuits-busy-now.ulaw’ (language ‘en’)
[2020-06-17 13:14:23] VERBOSE[30434][C-00000001] file.c: <PJSIP/90501-00000000> Playing ‘please-try-call-later.ulaw’ (language ‘en’)
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [h@from-internal:1] Macro(“PJSIP/90501-00000000”, “hangupcall”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@macro-hangupcall:1] GotoIf(“PJSIP/90501-00000000”, “1?theend”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx_builtins.c: Goto (macro-hangupcall,s,3)
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@macro-hangupcall:3] ExecIf(“PJSIP/90501-00000000”, “0?Set(CDR(recordingfile)=)”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@macro-hangupcall:4] NoOp(“PJSIP/90501-00000000”, " montior file= ") in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@macro-hangupcall:5] GotoIf(“PJSIP/90501-00000000”, “1?skipagi”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx_builtins.c: Goto (macro-hangupcall,s,7)
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@macro-hangupcall:7] Hangup(“PJSIP/90501-00000000”, “”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] app_macro.c: Spawn extension (macro-hangupcall, s, 7) exited non-zero on ‘PJSIP/90501-00000000’ in macro ‘hangupcall’
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Spawn extension (from-internal, h, 1) exited non-zero on ‘PJSIP/90501-00000000’
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] app_stack.c: PJSIP/90501-00000000 Internal Gosub(crm-hangup,s,1) start
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@crm-hangup:1] NoOp(“PJSIP/90501-00000000”, “Sending Hangup to CRM”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@crm-hangup:2] NoOp(“PJSIP/90501-00000000”, “HANGUP CAUSE: 21”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@crm-hangup:3] ExecIf(“PJSIP/90501-00000000”, “0?Set(__CRM_VOICEMAIL=)”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@crm-hangup:4] NoOp(“PJSIP/90501-00000000”, “MASTER CHANNEL: 1592396061.0 = 1592396061.0”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@crm-hangup:5] GotoIf(“PJSIP/90501-00000000”, “0?return”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@crm-hangup:6] Set(“PJSIP/90501-00000000”, “__CRM_HANGUP=1”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@crm-hangup:7] AGI(“PJSIP/90501-00000000”, “agi://127.0.0.1/sangomacrm.agi”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] res_agi.c: <PJSIP/90501-00000000>AGI Script agi://127.0.0.1/sangomacrm.agi completed, returning 0
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] pbx.c: Executing [s@crm-hangup:8] Return(“PJSIP/90501-00000000”, “”) in new stack
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] app_stack.c: Spawn extension (from-internal, h, 1) exited non-zero on ‘PJSIP/90501-00000000’
[2020-06-17 13:14:25] VERBOSE[30434][C-00000001] app_stack.c: PJSIP/90501-00000000 Internal Gosub(crm-hangup,s,1) complete GOSUB_RETVAL=

not enough X’s

i’ve tried from 10 x’s to 14 x’s and still no joy…

with the exception of Brampton, phone numbers are 10 digits long, adding the 0 trunk prefix if needed by your vsp.

i dial:
907950931333

i want the below to convert it to
447950931333

doesn’t work and here’s the logs

[2020-06-17 15:42:45] VERBOSE[18211][C-00000005] pbx.c: Executing [907950931734@zulu-from-internal:1] Set(“PJSIP/90501-00000004”, “ZULU_ID=8c921b92-d4b4-4567-a8e5-92cbb26f3f61”) in new stack
[2020-06-17 15:42:45] VERBOSE[18211][C-00000005] pbx.c: Executing [907950931734@zulu-from-internal:2] Goto(“PJSIP/90501-00000004”, “from-internal,907950931734,1”) in new stack
[2020-06-17 15:42:45] VERBOSE[18211][C-00000005] pbx_builtins.c: Goto (from-internal,907950931734,1)
[2020-06-17 15:42:45] VERBOSE[18211][C-00000005] pbx.c: Executing [907950931734@from-internal:1] ResetCDR(“PJSIP/90501-00000004”, “”) in new stack
[2020-06-17 15:42:45] VERBOSE[18211][C-00000005] pbx.c: Executing [907950931734@from-internal:2] NoCDR(“PJSIP/90501-00000004”, “”) in new stack
[2020-06-17 15:42:45] VERBOSE[18211][C-00000005] pbx.c: Executing [907950931734@from-internal:3] Progress(“PJSIP/90501-00000004”, “”) in new stack
[2020-06-17 15:42:45] VERBOSE[18211][C-00000005] pbx.c: Executing [907950931734@from-internal:4] Wait(“PJSIP/90501-00000004”, “1”) in new stack
[2020-06-17 15:42:45] ERROR[17938] pjproject: icess0x7f998815b348 …Error sending STUN request: Network is unreachable

thats a zulu problem, try over with a soft or hard phone firts

Hey there
just tried using a softphone

[2020-06-18 06:46:03] VERBOSE[20681][C-00000007] pbx.c: Executing [907950931734@from-internal:1] ResetCDR(“PJSIP/501-00000006”, “”) in new stack
[2020-06-18 06:46:03] VERBOSE[20681][C-00000007] pbx.c: Executing [907950931734@from-internal:2] NoCDR(“PJSIP/501-00000006”, “”) in new stack
[2020-06-18 06:46:03] VERBOSE[20681][C-00000007] pbx.c: Executing [907950931734@from-internal:3] Progress(“PJSIP/501-00000006”, “”) in new stack
[2020-06-18 06:46:03] VERBOSE[20681][C-00000007] pbx.c: Executing [907950931734@from-internal:4] Wait(“PJSIP/501-00000006”, “1”) in new stack
[2020-06-18 06:46:04] VERBOSE[20681][C-00000007] pbx.c: Executing [907950931734@from-internal:5] Playback(“PJSIP/501-00000006”, “silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer”) in new stack
[2020-06-18 06:46:04] VERBOSE[20681][C-00000007] file.c: <PJSIP/501-00000006> Playing ‘silence/1.ulaw’ (language ‘en’)
[2020-06-18 06:46:05] VERBOSE[20681][C-00000007] file.c: <PJSIP/501-00000006> Playing ‘cannot-complete-as-dialed.ulaw’ (language ‘en’)
[2020-06-18 06:46:08] VERBOSE[20681][C-00000007] file.c: <PJSIP/501-00000006> Playing ‘check-number-dial-again.ulaw’ (language ‘en’)

Try with

X.

to get rid of your probably wrong numbers of X and then try again.
I always try to minimize possible Errors and then work through my Problem.

1 Like

As @Edge2020 says. If you still have trouble, at the Asterisk command prompt, type
pjsip set logger on
and make a test call. Paste the relevant section of the Asterisk log at https://pastebin.freepbx.org and post the link here.

is there more to the command than the above?

[root@voip ~]# pjsip set logger on
-bash: pjsip: command not found
[root@voip ~]#

do you mean like this?

1 Like

Yes, so every number will be matched - no matter how many digits there really are

You need to execute this command at the asterisk shell.
Try with:

asterisk -rcvvvv

and then execute the pjsip debug command again.

here’s the log with X. used

i’m now getting a ‘all circuits are busy now’

[2020-06-18 07:14:21] VERBOSE[25167][C-00000008] pbx.c: Executing [907950931734@from-internal:13] Macro(“PJSIP/501-00000007”, “outisbusy,”) in new stack
[2020-06-18 07:14:21] VERBOSE[25167][C-00000008] pbx.c: Executing [s@macro-outisbusy:1] Progress(“PJSIP/501-00000007”, “”) in new stack
[2020-06-18 07:14:21] VERBOSE[25167][C-00000008] pbx.c: Executing [s@macro-outisbusy:2] GotoIf(“PJSIP/501-00000007”, “0?emergency,1”) in new stack
[2020-06-18 07:14:21] VERBOSE[25167][C-00000008] pbx.c: Executing [s@macro-outisbusy:3] GotoIf(“PJSIP/501-00000007”, “0?intracompany,1”) in new stack
[2020-06-18 07:14:21] VERBOSE[25167][C-00000008] pbx.c: Executing [s@macro-outisbusy:4] Playback(“PJSIP/501-00000007”, “all-circuits-busy-now&please-try-call-later, noanswer”) in new stack
[2020-06-18 07:14:21] VERBOSE[25167][C-00000008] file.c: <PJSIP/501-00000007> Playing ‘all-circuits-busy-now.ulaw’ (language ‘en’)
[2020-06-18 07:14:22] VERBOSE[25167][C-00000008] file.c: <PJSIP/501-00000007> Playing ‘please-try-call-later.ulaw’ (language ‘en’)

great i’ve now done this

where can i pick up the logs for it once i’ve tried another call using a soft phone

ahh i see it prints it in the terminal

<— Transmitting SIP response (314 bytes) to UDP:188.213.136.18:18714 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.1.153:37145;rport=18714;received=188.213.136.18;branch=z9hG4bK181309047
Call-ID: [email protected]
From: sip:[email protected];tag=1802669652
To: sip:[email protected]
CSeq: 41 INVITE
Server: FPBX-15.0.16.53(16.9.0)
Content-Length: 0

== Using SIP RTP Audio TOS bits 184
== Using SIP RTP Audio TOS bits 184 in TCLASS field.
== Using SIP RTP Audio CoS mark 5
– Executing [447950931734@from-internal:1] ResetCDR(“PJSIP/501-00000008”, “”) in new stack
– Executing [447950931734@from-internal:2] NoCDR(“PJSIP/501-00000008”, “”) in new stack
– Executing [447950931734@from-internal:3] Progress(“PJSIP/501-00000008”, “”) in new stack
– Executing [447950931734@from-internal:4] Wait(“PJSIP/501-00000008”, “1”) in new stack
> 0x7f98fc03a640 – Strict RTP learning after remote address set to: 188.213.136.18:17202
<— Transmitting SIP response (799 bytes) to UDP:188.213.136.18:18714 —>
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 192.168.1.153:37145;rport=18714;received=188.213.136.18;branch=z9hG4bK181309047
Call-ID: [email protected]
From: sip:[email protected];tag=1802669652
To: sip:[email protected];tag=38b72e60-afbd-4b0d-9f6d-94fe75d97101
CSeq: 41 INVITE
Server: FPBX-15.0.16.53(16.9.0)
Contact: sip:217.138.34.101:5060
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Content-Type: application/sdp
Content-Length: 253

v=0
o=- 8000 8002 IN IP4 217.138.34.101
s=Asterisk
c=IN IP4 217.138.34.101
t=0 0
m=audio 12816 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

   > 0x7f98fc03a640 -- Strict RTP switching to RTP target address 188.213.136.18:17202 as source
-- Executing [447950931734@from-internal:5] Playback("PJSIP/501-00000008", "silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer") in new stack
-- <PJSIP/501-00000008> Playing 'silence/1.ulaw' (language 'en')
-- <PJSIP/501-00000008> Playing 'cannot-complete-as-dialed.ulaw' (language 'en')
-- <PJSIP/501-00000008> Playing 'check-number-dial-again.ulaw' (language 'en')
   > 0x7f98fc03a640 -- Strict RTP learning complete - Locking on source address 188.213.136.18:17202

<— Received SIP request (333 bytes) from UDP:188.213.136.18:18714 —>
CANCEL sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 192.168.1.153:37145;branch=z9hG4bK181309047;rport
Call-ID: [email protected]
From: sip:[email protected];tag=1802669652
To: sip:[email protected]
CSeq: 41 CANCEL
Max-Forwards: 70
User-Agent: Grandstream Wave 1.0.3.34
Content-Length: 0

i can see in the above log it’s now converting the mobile number from
07950931734
to
447950931734

…which is what my sip trunk provider requires which is good

Is your outgoing Trunk setup correctly?
Seems like you have an emergency outgoing route and one intracompany. None of them matches, so you can’t dial out.