Call forward to an external number

Hi there, I’m attempting to perform a call forward using the phones call forward feature, which returns the errors shown below (my mobile being the blanks)

I’ve tried it with a 9 in-front and without and I can’t find anything to figure out the RDNIS error, or to get the call completion working :confused:

Any help you can offer is greatly appreciated, and any help on giving you logs would be great as this is my first time having to diagnose an issue.

Thank you :slight_smile:

1 Like

First tip is to set the verbose higher so we get a bit more information.
With the little information there is, looks like you have not configured your “sip-main” trunk correctly.
You should look at that first.

1 Like

Thank you for replying :):grinning:
How high would you suggest setting it to get adequate information?

In the below output I set the verbose to 10:
== Using SIP RTP CoS mark 5
> 0x7fdeec031cb0 – Strict RTP learning after remote address set to: EXTERNAL IP OF TRUNK:PORT
– Executing [ORIGINAL CALLED NUMBER@incoming:1] SIPAddHeader(“SIP/TRUNK”, "Alert-Info: ") in new stack
– Executing [ORIGINAL CALLED NUMBER@incoming:2] Playback(“SIP/TRUNK”, “/var/lib/asterisk/sounds/custom/sound file”) in new stack
[Feb 27 16:26:08] WARNING[24084][C-0000003b]: mp3/interface.c:217 decodeMP3: Junk at the beginning of frame 49443304
– <SIP/TRUNK> Playing ‘/var/lib/asterisk/sounds/custom/sound file.slin’ (language ‘en_GB’)
> 0x7fdeec031cb0 – Strict RTP switching to RTP target address EXTERNAL IP OF TRUNK:PORT as source
> 0x7fdeec031cb0 – Strict RTP learning complete - Locking on source address EXTERNAL IP OF TRUNK:PORT
– Executing [ORIGINAL CALLED NUMBER@incoming:3] Dial(“SIP/TRUNK”, “SIP/102,30”) in new stack
== Using SIP RTP CoS mark 5
– Called SIP/102
– SIP/102-00000072 is ringing
– Got SIP response 302 “Moved Temporarily” back from EXTERNAL IP OF PHONE:PORT
[Feb 27 16:26:18] WARNING[14754][C-0000003b]: chan_sip.c:18213 get_rdnis: Huh? Not an RDNIS SIP header (reason=unconditional)?
– Now forwarding SIP/TRUNK to ‘Local/EXTERNAL NUMBER TO FORWARD TO@sip-main’ (thanks to SIP/102-00000072)
[Feb 27 16:26:18] NOTICE[24084][C-0000003b]: app_dial.c:1000 do_forward: Not accepting call completion offers from call-forward recipient Local/EXTERNAL NUMBER TO FORWARD TO@sip-main-00000002;1
[Feb 27 16:26:18] NOTICE[24084][C-0000003b]: core_local.c:756 local_call: No such extension/context EXTERNAL NUMBER TO FORWARD TO@sip-main while calling Local channel
[Feb 27 16:26:18] NOTICE[24084][C-0000003b]: app_dial.c:1106 do_forward: Forwarding failed to dial ‘Local/EXTERNAL NUMBER TO FORWARD TO@sip-main’
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [ORIGINAL CALLED NUMBER@incoming:4] VoiceMail(“SIP/TRUNK”, “102”) in new stack
– <SIP/TRUNK> Playing ‘vm-intro.alaw’ (language ‘en_GB’)
== Spawn extension (incoming, ORIGINAL CALLED NUMBER, 4) exited non-zero on ‘SIP/TRUNK’

If I need to un-censor any of the log let me know, you can never be too careful!

1 Like

Anything related to its context or extension of output, the context that it has permission for external calls?

1 Like

It is better if you post the logs instead of only a picture, I have seems this issue before, and most of the time it is carrier related usually destination reject the call

1 Like

What logs would be helpful to this? Anything in particular that would help diagnose it?

1 Like

This is my extensions.conf (minus the incoming context)





exten => 1500,1,GotoIf($[${CALLERID(rdnis)}]?2:400)
exten => 1500,2,MailboxExists(${CALLERID(rdnis)}@default)
exten => 1500,3,Congestion
exten => 1500,4,Hangup
exten => 1500,104,Voicemail(su${CALLERID(rdnis)})
exten => 1500,105,Playback(vm-goodbye)
exten => 1500,106,Hangup
exten => 1500,400,VoicemailMain(${CALLERID(num)})


(outgoing numbers, in format of
exten => _9./100,1,Set(CALLERID(num)=NUMBER)
exten => _9.,n,Dial(SIP/TRUNK/${EXTEN:1},120)
exten => _9.,n,Congestion


exten => _XXX,1,SIPAddHeader(Alert-Info: )
exten => _XXX,2,Set(CallerIDString=${CALLERID(all)})
exten => _XXX,3,Dial(SIP/${EXTEN},30)
exten => _XXX,4,hangup

exten => _N0XX,1,SIPAddHeader(Alert-Info: )
exten => _N0XX,2,Set(CallerIDString=${CALLERID(all)})
exten => _N0XX,3,Dial(SIP/${EXTEN},30)
exten => _N0XX,4,hangup

exten => _XXXXXXXXXX,1,SIPAddHeader(Alert-Info: )
exten => _XXXXXXXXXX,2,Set(CallerIDString=${CALLERID})
exten => _XXXXXXXXXX,3,Dial(SIP/${EXTEN},30)
exten => _XXXXXXXXXX,4,hangup

exten => _XXXXXXXXXXX,1,SIPAddHeader(Alert-Info: )
exten => _XXXXXXXXXXX,2,Set(CallerIDString=${CALLERID})
exten => _XXXXXXXXXXX,3,Dial(SIP/${EXTEN},30)
exten => _XXXXXXXXXXX,4,hangup

include => services
include => outgoing

And my sip.conf

port = 5060
bindaddr =
;context = sip-main
disallow = all
;allow = ulaw
allow = alaw
;allow = g729
recordhistory = yes
srvlookup = yes
dtmfmode = rfc2833
subscribemwi = yes
externip = EXTERNAL IP

context = incoming
host = TRUNK IP
canreinvite = no
qualify = yes
session-expires = 86400
session-timers = refuse

;## Handsets ##

1 Like

When doing the call forward, do you need to have a prefix of a 9 or without? I have tried using both, neither of which work so I’m unsure which is correct.

1 Like

Numbering plans are determined by the network operator.

1 Like

Apologies slightly confused, do you mean the trunk provider?

1 Like

Yes. Whoever provides routing for the outbound leg of your call.

1 Like

Install ngrep on your *.

Then give the following command:

ngrep -d any -qt number_called -W byline

The “number_called” is the number you will be dialing.
Then make the call.

The result will give you the signaling, that will help you to see what happens in the communication between your phone and * and * and your sip provider at the signaling level.

Yes, you could also enable sip debug on asterisk, but I like to read the clean signaling



Results below,

[root@localhost ~]# ngrep -d any -qt number_called -W byline
interface: any
match: number_called

U 2018/03/05 10:54:38.037499 connectivity_provider_ip:1026 ->
SIP/2.0 302 Moved Temporarily.
Via: SIP/2.0/UDP external_ip:5060;rport=5060;received=external_ip;branch=z 9hG4bK6f529c72.
Call-ID: 480d5f3a2a500e3439807028074fd41b@external_ip:5060.
From: sip:number_called_from@external_ip;tag=as6ff280c4.
To: sip:102@connectivity_provider_ip:1026;ob;tag=MsqM2x8CjSY2VqNtu1l1mJDMFU5Kp6vX.
CSeq: 102 INVITE.
User-Agent: UniFi VoIP Phone
Contact: sip:number_called@external_ip;transport=udp.
Supported: replaces, path, timer, eventlist.
Diversion: reason=unconditional.
Content-Length: 0.

1 Like


I’ve asked the provider and they’ve stated they’re not causing this, what in particular could I do to check this?

Or would I just need to ask them to investigate further?

1 Like

I didn’t say your provider was causing it. I said you had to provide what your provider requires. If the provider requires a 9, you need to provide that. If they don’t want one, you mustn’t provide it.

It looks like your provider is redirecting you to a different machine. In that case, you need to enable promiscuous redirection.

This might not be sufficient if they require authentication. In that case you are going to have to do a normal redirection, but look at the target domain in the dialplan, and either add the authentication in the dial string, or make sure you have sip.conf entries for all the possible IP addresses.

This sort of redirection can happen if they have a load balancing proxy.

It is also possible you have simply misunderstood which machine name you should use for outbound calls.

1 Like

Thanks for the reply, by adding authentication from the dial string, what would this be? Would it be the number followed by @(the trunk)?

And how is promiscuous redirection enabled within asterisk?

In sip.conf what would the syntax be for adding additional IP entries? Would they go within the trunks context or within general?

Thank you so much for your help so far

1 Like

Additionally, the provider doesn’t need a 9 in this instance, just the number.

1 Like

promiscuous redirection is enable by turning on the promiscuous redirection option. Both this and the format of the resource part of the dial string for chan_sip are documented in the primary documentation source for chan_sip, the sample configuration file.

That’s brilliant thank you - I’ll give it a read and a try and get back to you!

1 Like

Thank you so much! Adding promiscredir=yes to my sip.conf under general, and adding @ followed by the trunk domain when putting the forward on the phone, sent it through.

Last piece of the puzzle is to append the domain to the start of the number in asterisk if this is possible? So that @trunk isn’t required to be added every time.

Thank you

1 Like