Call forwarding issues part 2

Hi all, need some help with the below please:

Macro in dialplan:

[macro-callforwarding]
;Unconditional call forward
exten => s,1,Set(temp=${DB(CFIM/${ARG1})})
exten => s,n,GotoIf(${temp}?cfi:nocfi)
exten => s,n(cfi),NoOp( CFI Found)
exten => s,n,Set(CallerIDString=${CALLERID})
exten => s,n,Dial(SIP/${temp})
exten => s,n,Dial(SIP/${temp}@DC2N16OTP37076_A1)
exten => s,n,Hangup()
exten => s,n(nocfi),NoOp(No CFI found)

Number being called from outbound (working)

 Using SIP RTP CoS mark 5
       > 0x7fb314045400 -- Strict RTP learning after remote address set to: 10.8.0.8:12064
    -- Executing [************@support:1] Set("SIP/203-00000851", "CALLERID(all)="Xiria Technical Support" <************>") in new stack
    -- Executing [XXXXXXXXXXXX@support:2] SIPAddHeader("SIP/203-00000851", "Alert-Info: <Bellcore-dr1>") in new stack
    -- Executing [XXXXXXXXXXXX@support:3] MixMonitor("SIP/203-00000851", "/var/www/html/recordings/outgoing/XXXXXXXXXXXX-12122019-16:37:48.wav") in new stack
    -- Executing [************@support:4] Dial("SIP/203-00000851", "SIP/DC2N16OTP37076_A1/************,120") in new stack
  == Begin MixMonitor Recording SIP/203-00000851
  == Using SIP RTP CoS mark 5
    -- Called SIP/DC2N16OTP37076_A1/XXXXXXXXXXXX
  == Using SIP RTP CoS mark 5
       > 0x7fb3140508a0 -- Strict RTP learning after remote address set to: XXX.XXX.XXX.XXX:21200
    -- Executing [************@incoming:1] GotoIfTime("SIP/DC2N16OTP37076_A1-00000853", "09:00-17:30,mon-fri,*,?support,1:supportooa,1") in new stack
    -- Goto (incoming,support,1)
    -- Executing [support@incoming:1] SIPAddHeader("SIP/DC2N16OTP37076_A1-00000853", "Alert-Info: <SUPPORT:>") in new stack
    -- Executing [support@incoming:2] Playback("SIP/DC2N16OTP37076_A1-00000853", "/var/lib/asterisk/sounds/custom/Xiria Technical Support") in new stack
       > 0x7fb310003c50 -- Strict RTP learning after remote address set to: XXX.XXX.XXX.XXX:21202
    -- SIP/DC2N16OTP37076_A1-00000852 answered SIP/203-00000851
    -- Channel SIP/DC2N16OTP37076_A1-00000852 joined 'simple_bridge' basic-bridge <68c43240-eb11-438a-93f5-26db3b21cdec>
    -- Channel SIP/203-00000851 joined 'simple_bridge' basic-bridge <68c43240-eb11-438a-93f5-26db3b21cdec>
       > 0x7fb314045400 -- Strict RTP switching to RTP target address 10.8.0.8:12064 as source
       > 0x7fb3140508a0 -- Strict RTP switching to RTP target address XXX.XXX.XXX.XXX:21200 as source
[Dec 12 16:37:48] WARNING[7005][C-000002e9]: mp3/interface.c:217 decodeMP3: Junk at the beginning of frame 49443304
    -- <SIP/DC2N16OTP37076_A1-00000853> Playing '/var/lib/asterisk/sounds/custom/Xiria Technical Support.slin' (language 'en_GB')
       > 0x7fb310003c50 -- Strict RTP switching to RTP target address XXX.XXX.XXX.XXX:21202 as source
       > 0x7fb314045400 -- Strict RTP learning complete - Locking on source address 10.8.0.8:12064
       > 0x7fb3140508a0 -- Strict RTP learning complete - Locking on source address XXX.XXX.XXX.XXX:21200
       > 0x7fb310003c50 -- Strict RTP learning complete - Locking on source address 8XXX.XXX.XXX.XXX:21202
    -- Executing [support@incoming:3] Macro("SIP/DC2N16OTP37076_A1-00000853", "callforwarding,202") in new stack
    -- Executing [s@macro-callforwarding:1] Set("SIP/DC2N16OTP37076_A1-00000853", "temp=ForwardedNumber") in new stack
    -- Executing [s@macro-callforwarding:2] GotoIf("SIP/DC2N16OTP37076_A1-00000853", "ForwardedNumber?cfi:nocfi") in new stack
    -- Goto (macro-callforwarding,s,3)
    -- Executing [s@macro-callforwarding:3] NoOp("SIP/DC2N16OTP37076_A1-00000853", " CFI Found") in new stack
    -- Executing [s@macro-callforwarding:4] Set("SIP/DC2N16OTP37076_A1-00000853", "CallerIDString=") in new stack
    -- Executing [s@macro-callforwarding:5] Dial("SIP/DC2N16OTP37076_A1-00000853", "SIP/ForwardedNumber") in new stack
[Dec 12 16:37:58] WARNING[7005][C-000002e9]: chan_sip.c:6274 create_addr: Purely numeric hostname (ForwardedNumber), and not a peer--rejecting!
[Dec 12 16:37:58] WARNING[7005][C-000002e9]: app_dial.c:2527 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-callforwarding:6] Dial("SIP/DC2N16OTP37076_A1-00000853", "SIP/ForwardedNumber@DC2N16OTP37076_A1") in new stack
  == Using SIP RTP CoS mark 5
    -- Called SIP/ForwardedNumber@DC2N16OTP37076_A1
       > 0x7fb31800aac0 -- Strict RTP learning after remote address set to: XXX.XXX.XXX.XXX:21326
    -- SIP/DC2N16OTP37076_A1-00000854 is making progress passing it to SIP/DC2N16OTP37076_A1-00000853
    -- SIP/DC2N16OTP37076_A1-00000854 is ringing
       > 0x7fb31800aac0 -- Strict RTP switching to RTP target address XXX.XXX.XXX.XXX:21326 as source
    -- SIP/DC2N16OTP37076_A1-00000854 is ringing
    -- Channel SIP/203-00000851 left 'simple_bridge' basic-bridge <68c43240-eb11-438a-93f5-26db3b21cdec>
    -- Channel SIP/DC2N16OTP37076_A1-00000852 left 'simple_bridge' basic-bridge <68c43240-eb11-438a-93f5-26db3b21cdec>
  == Spawn extension (support, ************, 4) exited non-zero on 'SIP/203-00000851'
  == MixMonitor close filestream (mixed)
  == End MixMonitor Recording SIP/203-00000851
  == Spawn extension (macro-callforwarding, s, 6) exited non-zero on 'SIP/DC2N16OTP37076_A1-00000853' in macro 'callforwarding'
  == Spawn extension (incoming, support, 3) exited non-zero on 'SIP/DC2N16OTP37076_A1-00000853'

Number being called internally:

 == Using SIP RTP CoS mark 5
       > 0x7fb314045400 -- Strict RTP learning after remote address set to: 10.8.0.8:12066
    -- Executing [202@support:1] SIPAddHeader("SIP/203-00000855", "Alert-Info: <Bellcore-dr1>") in new stack
    -- Executing [202@support:2] Set("SIP/203-00000855", "CallerIDString=") in new stack
    -- Executing [202@support:3] Macro("SIP/203-00000855", "callforwarding,202") in new stack
    -- Executing [s@macro-callforwarding:1] Set("SIP/203-00000855", "temp=ForwardedNumber") in new stack
    -- Executing [s@macro-callforwarding:2] GotoIf("SIP/203-00000855", "ForwardedNumber?cfi:nocfi") in new stack
    -- Goto (macro-callforwarding,s,3)
    -- Executing [s@macro-callforwarding:3] NoOp("SIP/203-00000855", " CFI Found") in new stack
    -- Executing [s@macro-callforwarding:4] Set("SIP/203-00000855", "CallerIDString=") in new stack
    -- Executing [s@macro-callforwarding:5] Dial("SIP/203-00000855", "SIP/ForwardedNumber") in new stack
[Dec 12 16:43:16] WARNING[7015][C-000002ea]: chan_sip.c:6274 create_addr: Purely numeric hostname (ForwardedNumber), and not a peer--rejecting!
[Dec 12 16:43:16] WARNING[7015][C-000002ea]: app_dial.c:2527 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-callforwarding:6] Dial("SIP/203-00000855", "SIP/ForwardedNumber@DC2N16OTP37076_A1") in new stack
  == Using SIP RTP CoS mark 5
    -- Called SIP/ForwardedNumber@DC2N16OTP37076_A1
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-callforwarding:7] Hangup("SIP/203-00000855", "") in new stack
  == Spawn extension (macro-callforwarding, s, 7) exited non-zero on 'SIP/203-00000855' in macro 'callforwarding'
  == Spawn extension (support, 202, 3) exited non-zero on 'SIP/203-00000855'

It works fine when being called from an outside line, the config for which is below:

exten => support,1,SIPAddHeader(Alert-Info: <SUPPORT:>)
exten => support,n,Playback(/var/lib/asterisk/sounds/custom/Xiria Technical Support)
exten => support,n,Macro(callforwarding,202)
exten => support,n,Macro(callforwarding,203)
exten => support,n,Mixmonitor(/var/www/html/recordings/${CONTEXT}-${CALLERID(number)}-${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}.wav)
exten => support,n,Queue(${EXTEN})
exten => support,n,Voicemail(200)  ;To use custom, do ,busy or ,unavail

Though not when called from an internal number. Any ideas?

I would set up a packet capture and inspect the message returned by your upstream to see why they are rejecting the call.

It may be as simple as an internal caller not having valid caller ID.

set sip debug on for this peer and check what the difference is in outgoing INVITE packets for those 2 scenarios.
Further, also look at the responses coming back from this peer as mentioned by @johnkiniston

The only thing rejecting this call is Asterisk because it cannot find a proper peer to send the call through.

Although this wasn’t explained, I assumed the logic was that it would try this first on the basis that local device names were the same as extension numbers, and fall back to using a service provider. As such I assumed that the failure of the first Dial was intentional and it was the second one that was at issue.

Could the OP possibly explain the intended logic?

Yes because there are serious flaws already in all this.

So in priority 1 ${temp} is set to the value of the AstDB call, if that is empty then so is ${temp}. The next priority is running a GoToIf statement but what is the actual condition because nothing is being compared. So is it always true?

Last I checked this had to be used like ${CALLERID(num)} not just ${CALLERID}

Why does this exist? It’s either going to be Dial(SIP/) or Dial(SIP/<external number>) with no peer or proper URI string to send the call to. This is always going to fail unless the CF’d destination is an actual peer on the system.

I’d actually expect a null string to be treated as false, although I would have used string quotes and an explicit comparison against an empty string. I think there is also an EMPTY function.

I’m fairly sure that calling CALLERID without parameters gives something useful.

I think the first Dial is to test whether the peer exists on the system, although it is not a standard way of doing it, and it will fall through for reasons other than the number being external.

Right as we are both in agreement. There are serious logic problems with all this. Plus, Macro()? It’s deprecated. This should be done via GoSub()'s.

Hi David,

You’re correct in this instance yes. The first dial is intended to work if the user placed an internal extension, and the second would work if they put an external number. This works fine when called from an inbound number, though when called internally it has the issue that I’m describing.

As I mentioned above, this is internional on that part of the log. The purpose behind the two different statements is that one will work for an internal, one will work for an external.

This is done purely as I didn’t know a more elegant way to make the statement, if any of you know then I’d love to learn how, as it would likely fix the issue at hand at the same time!

The reason for the macro statement being used currently is it’s an older PBX for a large retailer, so changing the functionality isn’t a painless process unfortunately.

Hi John,

Thank you for this. What would be the best way for me to go about this? I haven’t done packet captures in this way before. Would I set it up on the local server or on a remote device?

Many thanks.

Normally you would know which were the valid internal number ranges and would have dialplan patterns that would match those. Even if they were only patterns, they would normally be a shorter match than the ones for external ones, so would take preference.

As you generally wouldn’t want outside callers to make outside call, you would probably put the internal ones ins a more public context, which would be included from the context used for more trusted callers. The latter would have patterns that matched outside calls.

Well there’s a lot of flaws in your current logic that need to be fixed and the only way to fix them it to understand your call flow. See right now you’re set to try and call forward the two local extensions individually. So now if the call forward for 202 does go out to an outside line there are a few things that are going to happen:

  1. You don’t have a timer set therefore it will use the default 300 seconds (5 minutes). If the remote destination (like a mobile phone) has voicemail, that voicemail picks up the call and that is where the call lands. So now the caller is presented with a personal voicemail greeting and could leave a voicemail there or just hang up.

  2. You have nothing to handle the various dialstatuses and deal with them. How do you want to handle things when the destination is busy or other failures?

  3. Why are you hanging up after those Dial() attempts in the Macro? Why aren’t you sending them back to the original context to get to the Queue? So basically your logic is, if there is a CF setup, regardless if it answers or not you’re going to hang up the call. So you could be hanging up valid calls that never got answered or had another status (like BUSY) returned. So what is even the point of it?

Hi Blaze,

I don’t want to sound ungrateful for the advise at all, this will certainly be something I look at in the new year, but I need this immediate issue fixed sooner. Do you have any ideas why the below would be happening?

 Executing [202@support:1] SIPAddHeader("SIP/203-000008f2", "Alert-Info: <Bellcore-dr1>") in new stack
    -- Executing [202@support:2] Set("SIP/203-000008f2", "CallerIDString=") in new stack
    -- Executing [202@support:3] Macro("SIP/203-000008f2", "callforwarding,202") in new stack
    -- Executing [s@macro-callforwarding:1] Set("SIP/203-000008f2", "temp=MyMobile") in new stack
    -- Executing [s@macro-callforwarding:2] GotoIf("SIP/203-000008f2", "MyMobile?cfi:nocfi") in new stack
    -- Goto (macro-callforwarding,s,3)
    -- Executing [s@macro-callforwarding:3] NoOp("SIP/203-000008f2", " CFI Found") in new stack
    -- Executing [s@macro-callforwarding:4] Set("SIP/203-000008f2", "CallerIDString=") in new stack
    -- Executing [s@macro-callforwarding:5] Dial("SIP/203-000008f2", "SIP/MyMobile") in new stack
[Dec 18 09:41:06] WARNING[15342][C-00000323]: chan_sip.c:6274 create_addr: Purely numeric hostname (07954380795), and not a peer--rejecting!
[Dec 18 09:41:06] WARNING[15342][C-00000323]: app_dial.c:2527 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-callforwarding:6] Dial("SIP/203-000008f2", "SIP/MyMobile@Trunk") in new stack
  == Using SIP RTP CoS mark 5
    -- Called SIP/07954380795@DC2N16OTP37076_A1
  == Everyone is busy/congested at this time (1:0/0/1)

It’s attempting to call out to the mobile via the trunk, though gets a busy status immediately. The mobile is not ringing, though I’m also not getting an error stating the number doesn’t exist.

If you have any thoughts on this it would be greatly appreciated.

In extensions to this, please see the IP debug:

    -- Executing [s@macro-callforwarding:6] Dial("SIP/203-00000903", "SIP/MyMobile@DC2N16OTP37076_A1") in new stack
  == Using SIP RTP CoS mark 5
Audio is at 15154
Adding codec alaw to SDP
Adding codec slin to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to TrunkIP:5060:
INVITE sip:MyMobile@TrunkIP SIP/2.0
Via: SIP/2.0/UDP AsteriskPublicIP:5060;branch=z9hG4bK4c0c744a;rport
Max-Forwards: 70
From: "Support" <sip:203@AsteriskPublicIP>;tag=as4dd43e26
To: <sip:MyMobile@TrunkIP>
Contact: <sip:203@AsteriskPublicIP:5060>
Call-ID: 163485d96902ab713b2ddaa2734441d2@AsteriskPublicIP:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.21.0
Date: Wed, 18 Dec 2019 10:20:12 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces
Alert-Info: <Bellcore-dr1>
Content-Type: application/sdp
Content-Length: 276

v=0
o=root 66052328 66052328 IN IP4 AsteriskPublicIP
s=Asterisk PBX 13.21.0
c=IN IP4 AsteriskPublicIP
t=0 0
m=audio 15154 RTP/AVP 8 10 101
a=rtpmap:8 PCMA/8000
a=rtpmap:10 L16/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:70
a=sendrecv

---
    -- Called SIP/MyMobile@DC2N16OTP37076_A1

<--- SIP read from UDP:TrunkIP:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP AsteriskPublicIP:5060;rport=5060;received=AsteriskPublicIP;branch=z9hG4bK4c0c744a
From: <sip:203@AsteriskPublicIP>;tag=as4dd43e26
To: <sip:MyMobile@TrunkIP>
Call-ID: 163485d96902ab713b2ddaa2734441d2@AsteriskPublicIP:5060
CSeq: 102 INVITE
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---

<--- SIP read from UDP:TrunkIP:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP AsteriskPublicIP:5060;rport=5060;received=AsteriskPublicIP;branch=z9hG4bK4c0c744a
To: <sip:MyMobile@TrunkIP>;tag=3785653212-1310559383
From: <sip:203@AsteriskPublicIP>;tag=as4dd43e26
Call-ID: 163485d96902ab713b2ddaa2734441d2@AsteriskPublicIP:5060
CSeq: 102 INVITE
Allow: UPDATE,PRACK,INFO,NOTIFY,REGISTER,OPTIONS,BYE,INVITE,ACK,CANCEL
Contact: <sip:MyMobile@TrunkIP:5060>
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Transmitting (NAT) to TrunkIP:5060:
ACK sip:MyMobile@TrunkIP SIP/2.0
Via: SIP/2.0/UDP AsteriskPublicIP:5060;branch=z9hG4bK4c0c744a;rport
Max-Forwards: 70
From: "Support" <sip:203@AsteriskPublicIP>;tag=as4dd43e26
To: <sip:MyMobile@TrunkIP>;tag=3785653212-1310559383
Contact: <sip:203@AsteriskPublicIP:5060>
Call-ID: 163485d96902ab713b2ddaa2734441d2@AsteriskPublicIP:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 13.21.0
Content-Length: 0


---
Scheduling destruction of SIP dialog '163485d96902ab713b2ddaa2734441d2@AsteriskPublicIP:5060' in 6400 ms (Method: INVITE)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-callforwarding:7] Hangup("SIP/203-00000903", "") in new stack
  == Spawn extension (macro-callforwarding, s, 7) exited non-zero on 'SIP/203-00000903' in macro 'callforwarding'
  == Spawn extension (support, 202, 3) exited non-zero on 'SIP/203-00000903'
Really destroying SIP dialog '163485d96902ab713b2ddaa2734441d2@AsteriskPublicIP:5060' Method: INVITE

This was where I enabled the forward on 202 to my mobile, and tried to call 202 from 203.

The peer at TrunkIP, or someone downstream of it, doesn’t believe that MyMobile is a valid phone number. If it is a valid phone number, you will have to ask them why they disagree.

Hi David,

Thank you for this. I’ve left the question with my provider and they’re looking into this currently :slight_smile:

Kind regards,

Richard

Hi David,

The provider has come back stating that as it [the call forward] works when an outbound number calls in but not when an internal number calls then it’s not on their end.

Is there anything within Asterisk that could be affecting this? My only thought is that it could be doing RTP locally and then failing to change this to use RTP over the internet, though I don’t know how to test or configure this.

Many thanks for your help thus far.

There is no call set up on that outgoing leg, so no RTP flowing. The call is rejected before it can even start. As @david551 mentioned the provider rejected the call with a 404 Not Found. It’s either something on their end, or your configuration is not quite correct and in some circumstances results in failure. For example some providers require “fromuser” to be set to the username. It can also be used to convey callerid. In you SIP trace it is “203” which is a local extension. Comparing a working and non-working SIP trace would provide better insight.

1 Like

Hi jcolp,

Thank you for the reply. Please see the below working example (being called externally):


<------------>
    -- Executing [OurDDI@incoming:1] GotoIfTime("SIP/DC2N16OTP37076_A1-00000929", "09:00-17:30,mon-fri,*,?support,1:supportooa,1") in new stack
    -- Goto (incoming,support,1)
    -- Executing [support@incoming:1] SIPAddHeader("SIP/DC2N16OTP37076_A1-00000929", "Alert-Info: <SUPPORT:>") in new stack
    -- Executing [support@incoming:2] Playback("SIP/DC2N16OTP37076_A1-00000929", "/var/lib/asterisk/sounds/custom/Xiria Technical Support") in new stack
Audio is at 13028
Adding codec alaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP

<--- Reliably Transmitting (NAT) to TrunkIP:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP TrunkIP:5060;branch=z9hG4bK29a4bfe71bdf8f99eea90b064f60f547;received=TrunkIP;rport=5060
From: <sip:InboundCaller@TrunkIP>;tag=3785658564-1828327716
To: <sip:OurDDI@TrunkIP>;tag=as1778187f
Call-ID: 33251031-3785658564-1678689038@MSX73.gammatelecom.com
CSeq: 1 INVITE
Server: Asterisk PBX 13.21.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces
Contact: <sip:OurDDI@PublicIP:5060>
Content-Type: application/sdp
Content-Length: 256

v=0
o=root 1174043070 1174043070 IN IP4 PublicIP
s=Asterisk PBX 13.21.0
c=IN IP4 PublicIP
t=0 0
m=audio 13028 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<------------>

<--- SIP read from UDP:TrunkIP:5060 --->
ACK sip:OurDDI@PublicIP:5060;user=phone SIP/2.0
Max-Forwards: 67
To: <sip:OurDDI@TrunkIP>;tag=as1778187f
From: <sip:InboundCaller@TrunkIP>;tag=3785658564-1828327716
Call-ID: 33251031-3785658564-1678689038@MSX73.gammatelecom.com
CSeq: 1 ACK
Via: SIP/2.0/UDP TrunkIP:5060;branch=z9hG4bK41100c31b82b239d9fb39150c37780c9
Contact: <sip:InboundCaller@TrunkIP:5060>
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
       > 0x7fb3140508a0 -- Strict RTP switching to RTP target address 88.215.63.8:36608 as source
[Dec 18 11:49:24] WARNING[15690][C-0000033b]: mp3/interface.c:217 decodeMP3: Junk at the beginning of frame 49443304
    -- <SIP/DC2N16OTP37076_A1-00000929> Playing '/var/lib/asterisk/sounds/custom/Xiria Technical Support.slin' (language 'en_GB')
       > 0x7fb3140508a0 -- Strict RTP learning complete - Locking on source address 88.215.63.8:36608
    -- Executing [support@incoming:3] Macro("SIP/DC2N16OTP37076_A1-00000929", "callforwarding,202") in new stack
    -- Executing [s@macro-callforwarding:1] Set("SIP/DC2N16OTP37076_A1-00000929", "temp=MyMobile") in new stack
    -- Executing [s@macro-callforwarding:2] GotoIf("SIP/DC2N16OTP37076_A1-00000929", "MyMobile?cfi:nocfi") in new stack
    -- Goto (macro-callforwarding,s,3)
    -- Executing [s@macro-callforwarding:3] NoOp("SIP/DC2N16OTP37076_A1-00000929", " CFI Found") in new stack
    -- Executing [s@macro-callforwarding:4] Set("SIP/DC2N16OTP37076_A1-00000929", "CallerIDString=MyMobile") in new stack
    -- Executing [s@macro-callforwarding:5] Dial("SIP/DC2N16OTP37076_A1-00000929", "SIP/MyMobile") in new stack
[Dec 18 11:49:34] WARNING[15690][C-0000033b]: chan_sip.c:6274 create_addr: Purely numeric hostname (MyMobile), and not a peer--rejecting!
[Dec 18 11:49:34] WARNING[15690][C-0000033b]: app_dial.c:2527 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-callforwarding:6] Dial("SIP/DC2N16OTP37076_A1-00000929", "SIP/MyMobile@DC2N16OTP37076_A1") in new stack
  == Using SIP RTP CoS mark 5
Audio is at 17908
Adding codec alaw to SDP
Adding codec slin to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to TrunkIP:5060:
INVITE sip:MyMobile@TrunkIP SIP/2.0
Via: SIP/2.0/UDP PublicIP:5060;branch=z9hG4bK4a939a11;rport
Max-Forwards: 70
From: <sip:InboundCaller@PublicIP>;tag=as445a6784
To: <sip:MyMobile@TrunkIP>
Contact: <sip:InboundCaller@PublicIP:5060>
Call-ID: 795fda521354e24a4be387b355672db4@PublicIP:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.21.0
Date: Wed, 18 Dec 2019 11:49:34 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces
Alert-Info: <SUPPORT:>
Content-Type: application/sdp
Content-Length: 278

v=0
o=root 491866604 491866604 IN IP4 PublicIP
s=Asterisk PBX 13.21.0
c=IN IP4 PublicIP
t=0 0
m=audio 17908 RTP/AVP 8 10 101
a=rtpmap:8 PCMA/8000
a=rtpmap:10 L16/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:70
a=sendrecv

---
    -- Called SIP/MyMobile@DC2N16OTP37076_A1

<--- SIP read from UDP:TrunkIP:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP PublicIP:5060;rport=5060;received=PublicIP;branch=z9hG4bK4a939a11
From: <sip:InboundCaller@PublicIP>;tag=as445a6784
To: <sip:MyMobile@TrunkIP>
Call-ID: 795fda521354e24a4be387b355672db4@PublicIP:5060
CSeq: 102 INVITE
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---

<--- SIP read from UDP:TrunkIP:5060 --->
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP PublicIP:5060;rport=5060;received=PublicIP;branch=z9hG4bK4a939a11
To: <sip:MyMobile@TrunkIP>;tag=3785658575-1187023408
From: <sip:InboundCaller@PublicIP>;tag=as445a6784
Call-ID: 795fda521354e24a4be387b355672db4@PublicIP:5060
CSeq: 102 INVITE
Allow: UPDATE,PRACK,INFO,NOTIFY,REGISTER,OPTIONS,BYE,INVITE,ACK,CANCEL
Contact: <sip:MyMobile@TrunkIP:5060>
Content-Type: application/sdp
Content-Length: 220

v=0
o=MSX73 3210568015 6371103 IN IP4 TrunkIP
s=sip call
c=IN IP4 88.215.63.8
t=0 0
a=sendrecv
m=audio 36744 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
<------------->
--- (10 headers 11 lines) ---
sip_route_dump: route/path hop: <sip:MyMobile@TrunkIP:5060>
Found RTP audio format 8
Found RTP audio format 101
Found audio description format PCMA for ID 8
Found audio description format telephone-event for ID 101
Capabilities: us - (alaw|slin), peer - audio=(alaw)/video=(nothing)/text=(nothing), combined - (alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
       > 0x7fb37c00a4c0 -- Strict RTP learning after remote address set to: 88.215.63.8:36744
Peer audio RTP is at port 88.215.63.8:36744
    -- SIP/DC2N16OTP37076_A1-0000092a is making progress passing it to SIP/DC2N16OTP37076_A1-00000929

<--- SIP read from UDP:TrunkIP:5060 --->
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP PublicIP:5060;rport=5060;received=PublicIP;branch=z9hG4bK4a939a11
To: <sip:MyMobile@TrunkIP>;tag=3785658575-1187023408
From: <sip:InboundCaller@PublicIP>;tag=as445a6784
Call-ID: 795fda521354e24a4be387b355672db4@PublicIP:5060
CSeq: 102 INVITE
Allow: UPDATE,PRACK,INFO,NOTIFY,REGISTER,OPTIONS,BYE,INVITE,ACK,CANCEL
Contact: <sip:MyMobile@TrunkIP:5060>
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
sip_route_dump: route/path hop: <sip:MyMobile@TrunkIP:5060>
    -- SIP/DC2N16OTP37076_A1-0000092a is ringing
       > 0x7fb37c00a4c0 -- Strict RTP switching to RTP target address 88.215.63.8:36744 as source

<--- SIP read from UDP:TrunkIP:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP PublicIP:5060;rport=5060;received=PublicIP;branch=z9hG4bK4a939a11
To: <sip:MyMobile@TrunkIP>;tag=3785658575-1187023408
From: <sip:InboundCaller@PublicIP>;tag=as445a6784
Call-ID: 795fda521354e24a4be387b355672db4@PublicIP:5060
CSeq: 102 INVITE
Allow: UPDATE,PRACK,INFO,NOTIFY,REGISTER,OPTIONS,BYE,INVITE,ACK,CANCEL
Contact: <sip:MyMobile@TrunkIP:5060>
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
sip_route_dump: route/path hop: <sip:MyMobile@TrunkIP:5060>
    -- SIP/DC2N16OTP37076_A1-0000092a is ringing

<--- SIP read from UDP:TrunkIP:5060 --->
BYE sip:OurDDI@PublicIP:5060;user=phone SIP/2.0
Max-Forwards: 67
To: <sip:OurDDI@TrunkIP>;tag=as1778187f
From: <sip:InboundCaller@TrunkIP>;tag=3785658564-1828327716
Call-ID: 33251031-3785658564-1678689038@MSX73.gammatelecom.com
CSeq: 2 BYE
Allow: UPDATE,INFO,NOTIFY,REGISTER,OPTIONS,BYE,INVITE,ACK,CANCEL
Via: SIP/2.0/UDP TrunkIP:5060;branch=z9hG4bK169b312f785ddc28d0bf77bb72334d00
Reason: SIP;cause=200;text="Normal End Of Call"
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---
Sending to TrunkIP:5060 (NAT)
Scheduling destruction of SIP dialog '33251031-3785658564-1678689038@MSX73.gammatelecom.com' in 6400 ms (Method: BYE)

<--- Transmitting (NAT) to TrunkIP:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP TrunkIP:5060;branch=z9hG4bK169b312f785ddc28d0bf77bb72334d00;received=TrunkIP;rport=5060
From: <sip:InboundCaller@TrunkIP>;tag=3785658564-1828327716
To: <sip:OurDDI@TrunkIP>;tag=as1778187f
Call-ID: 33251031-3785658564-1678689038@MSX73.gammatelecom.com
CSeq: 2 BYE
Server: Asterisk PBX 13.21.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '795fda521354e24a4be387b355672db4@PublicIP:5060' in 6400 ms (Method: INVITE)
Reliably Transmitting (NAT) to TrunkIP:5060:
CANCEL sip:MyMobile@TrunkIP SIP/2.0
Via: SIP/2.0/UDP PublicIP:5060;branch=z9hG4bK4a939a11;rport
Max-Forwards: 70
From: <sip:InboundCaller@PublicIP>;tag=as445a6784
To: <sip:MyMobile@TrunkIP>
Call-ID: 795fda521354e24a4be387b355672db4@PublicIP:5060
CSeq: 102 CANCEL
User-Agent: Asterisk PBX 13.21.0
Content-Length: 0


---
Scheduling destruction of SIP dialog '795fda521354e24a4be387b355672db4@PublicIP:5060' in 6400 ms (Method: INVITE)
  == Spawn extension (macro-callforwarding, s, 6) exited non-zero on 'SIP/DC2N16OTP37076_A1-00000929' in macro 'callforwarding'
  == Spawn extension (incoming, support, 3) exited non-zero on 'SIP/DC2N16OTP37076_A1-00000929'

<--- SIP read from UDP:TrunkIP:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP PublicIP:5060;rport=5060;received=PublicIP;branch=z9hG4bK4a939a11
To: <sip:MyMobile@TrunkIP>;tag=3785658575-1187023408
From: <sip:InboundCaller@PublicIP>;tag=as445a6784
Call-ID: 795fda521354e24a4be387b355672db4@PublicIP:5060
CSeq: 102 CANCEL
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---

<--- SIP read from UDP:TrunkIP:5060 --->
SIP/2.0 487 Request Terminated
Via: SIP/2.0/UDP PublicIP:5060;rport=5060;received=PublicIP;branch=z9hG4bK4a939a11
To: <sip:MyMobile@TrunkIP>;tag=3785658575-1187023408
From: <sip:InboundCaller@PublicIP>;tag=as445a6784
Call-ID: 795fda521354e24a4be387b355672db4@PublicIP:5060
CSeq: 102 INVITE
Allow: UPDATE,PRACK,INFO,NOTIFY,REGISTER,OPTIONS,BYE,INVITE,ACK,CANCEL
Contact: <sip:MyMobile@TrunkIP:5060>
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Transmitting (NAT) to TrunkIP:5060:
ACK sip:MyMobile@TrunkIP:5060 SIP/2.0
Via: SIP/2.0/UDP PublicIP:5060;branch=z9hG4bK4a939a11;rport
Max-Forwards: 70
From: <sip:InboundCaller@PublicIP>;tag=as445a6784
To: <sip:MyMobile@TrunkIP>;tag=3785658575-1187023408
Contact: <sip:InboundCaller@PublicIP:5060>
Call-ID: 795fda521354e24a4be387b355672db4@PublicIP:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 13.21.0
Content-Length: 0


---
Scheduling destruction of SIP dialog '795fda521354e24a4be387b355672db4@PublicIP:5060' in 6400 ms (Method: INVITE)

And below, the non-working (calling internally):

--- (12 headers 0 lines) ---
Really destroying SIP dialog '23b023614ffb2794080ef8d041d15e34@PublicIP:5060' Method: OPTIONS
  == Using SIP RTP CoS mark 5
       > 0x7fb3140508a0 -- Strict RTP learning after remote address set to: 10.8.0.8:12104
    -- Executing [202@support:1] SIPAddHeader("SIP/203-0000092b", "Alert-Info: <Bellcore-dr1>") in new stack
    -- Executing [202@support:2] Set("SIP/203-0000092b", "CallerIDString=") in new stack
    -- Executing [202@support:3] Macro("SIP/203-0000092b", "callforwarding,202") in new stack
    -- Executing [s@macro-callforwarding:1] Set("SIP/203-0000092b", "temp=MyMobile") in new stack
    -- Executing [s@macro-callforwarding:2] GotoIf("SIP/203-0000092b", "MyMobile?cfi:nocfi") in new stack
    -- Goto (macro-callforwarding,s,3)
    -- Executing [s@macro-callforwarding:3] NoOp("SIP/203-0000092b", " CFI Found") in new stack
    -- Executing [s@macro-callforwarding:4] Set("SIP/203-0000092b", "CallerIDString=MyMobile") in new stack
    -- Executing [s@macro-callforwarding:5] Dial("SIP/203-0000092b", "SIP/MyMobile") in new stack
[Dec 18 11:53:08] WARNING[15701][C-0000033c]: chan_sip.c:6274 create_addr: Purely numeric hostname (MyMobile), and not a peer--rejecting!
[Dec 18 11:53:08] WARNING[15701][C-0000033c]: app_dial.c:2527 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-callforwarding:6] Dial("SIP/203-0000092b", "SIP/MyMobile@DC2N16OTP37076_A1") in new stack
  == Using SIP RTP CoS mark 5
Audio is at 15340
Adding codec alaw to SDP
Adding codec slin to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to TrunkIP:5060:
INVITE sip:MyMobile@TrunkIP SIP/2.0
Via: SIP/2.0/UDP PublicIP:5060;branch=z9hG4bK2e21d4a9;rport
Max-Forwards: 70
From: "Support" <sip:203@PublicIP>;tag=as276bf185
To: <sip:MyMobile@TrunkIP>
Contact: <sip:203@PublicIP:5060>
Call-ID: 0a13979244f012845f92329f2e1d1c3c@PublicIP:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.21.0
Date: Wed, 18 Dec 2019 11:53:08 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces
Alert-Info: <Bellcore-dr1>
Content-Type: application/sdp
Content-Length: 280

v=0
o=root 1422354523 1422354523 IN IP4 PublicIP
s=Asterisk PBX 13.21.0
c=IN IP4 PublicIP
t=0 0
m=audio 15340 RTP/AVP 8 10 101
a=rtpmap:8 PCMA/8000
a=rtpmap:10 L16/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:70
a=sendrecv

---
    -- Called SIP/MyMobile@DC2N16OTP37076_A1

<--- SIP read from UDP:TrunkIP:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP PublicIP:5060;rport=5060;received=PublicIP;branch=z9hG4bK2e21d4a9
From: <sip:203@PublicIP>;tag=as276bf185
To: <sip:MyMobile@TrunkIP>
Call-ID: 0a13979244f012845f92329f2e1d1c3c@PublicIP:5060
CSeq: 102 INVITE
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---

<--- SIP read from UDP:TrunkIP:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP PublicIP:5060;rport=5060;received=PublicIP;branch=z9hG4bK2e21d4a9
To: <sip:MyMobile@TrunkIP>;tag=3785658788-720609715
From: <sip:203@PublicIP>;tag=as276bf185
Call-ID: 0a13979244f012845f92329f2e1d1c3c@PublicIP:5060
CSeq: 102 INVITE
Allow: UPDATE,PRACK,INFO,NOTIFY,REGISTER,OPTIONS,BYE,INVITE,ACK,CANCEL
Contact: <sip:MyMobile@TrunkIP:5060>
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Transmitting (NAT) to TrunkIP:5060:
ACK sip:MyMobile@TrunkIP SIP/2.0
Via: SIP/2.0/UDP PublicIP:5060;branch=z9hG4bK2e21d4a9;rport
Max-Forwards: 70
From: "Support" <sip:203@PublicIP>;tag=as276bf185
To: <sip:MyMobile@TrunkIP>;tag=3785658788-720609715
Contact: <sip:203@PublicIP:5060>
Call-ID: 0a13979244f012845f92329f2e1d1c3c@PublicIP:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 13.21.0
Content-Length: 0


---
Scheduling destruction of SIP dialog '0a13979244f012845f92329f2e1d1c3c@PublicIP:5060' in 6400 ms (Method: INVITE)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [s@macro-callforwarding:7] Hangup("SIP/203-0000092b", "") in new stack
  == Spawn extension (macro-callforwarding, s, 7) exited non-zero on 'SIP/203-0000092b' in macro 'callforwarding'
  == Spawn extension (support, 202, 3) exited non-zero on 'SIP/203-0000092b'