Call forward external

Hi everybody,
my knowledge in asterisk is limited and I’m crazy how to forward a call to an external fixed o mobile number. My environment is an asterisk platform ver. 11.8.1 and cisco spa504g phone. Now, when I set a callallforward inside the phone with internal extension of the office, everything works fine, but if I set an external number the call will be end prematurely. I have a digium dual span PRI card (WCTE23X). DAHDI Version: 2.9.0 Echo Canceller: MG2

this is the log of a reject call, any idea?

thanks
Stefano

where: 99999999 is the external number that call the internal extension 888888888 (int.ext 2249) and that should be forward the call to external number 777777777

<------------->
– Accepting call from ‘9999999999’ to ‘888888888’ on channel 0/1, span 2
– Executing [888888888@from-pri:1] Dial(“DAHDI/i2/9999999999-2559”, “SIP/2249,180,txX”) in new stack
== Using SIP RTP CoS mark 5
Audio is at 13504
Adding codec 100004 (alaw) to SDP
Adding codec 100003 (ulaw) to SDP
Adding codec 100008 (g729) to SDP
Adding codec 100002 (gsm) to SDP
Reliably Transmitting (no NAT) to 192.168.30.5:5060:
INVITE sip:2249@192.168.30.5:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.30.254:5060;branch=z9hG4bK110484d6
Max-Forwards: 70
From: sip:9999999999@192.168.30.254;tag=as28c5f89e
To: sip:2249@192.168.30.5:5060
Contact: sip:9999999999@192.168.30.254:5060
Call-ID: 6a45e4e97a49984b69df5aec792b2206@192.168.30.254:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 11.8.1
Date: Mon, 15 Jan 2018 11:26:06 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 275

v=0
o=root 449970934 449970934 IN IP4 192.168.30.254
s=Asterisk PBX 11.8.1
c=IN IP4 192.168.30.254
t=0 0
m=audio 13504 RTP/AVP 8 0 18 3
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:3 GSM/8000
a=ptime:20
a=sendrecv


-- Called SIP/2249

<— SIP read from UDP:192.168.30.5:5060 —>
SIP/2.0 100 Trying
To: sip:2249@192.168.30.5:5060
From: sip:9999999999@192.168.30.254;tag=as28c5f89e
Call-ID: 6a45e4e97a49984b69df5aec792b2206@192.168.30.254:5060
CSeq: 102 INVITE
Via: SIP/2.0/UDP 192.168.30.254:5060;branch=z9hG4bK110484d6
Server: Cisco/SPA504G-7.4.9a
Content-Length: 0

<------------->
— (8 headers 0 lines) —

<— SIP read from UDP:192.168.30.5:5060 —>
SIP/2.0 302 Moved Temporarily
To: sip:2249@192.168.30.5:5060;tag=9f17882ffc944365i0
From: sip:9999999999@192.168.30.254;tag=as28c5f89e
Call-ID: 6a45e4e97a49984b69df5aec792b2206@192.168.30.254:5060
CSeq: 102 INVITE
Via: SIP/2.0/UDP 192.168.30.254:5060;branch=z9hG4bK110484d6
Contact: sip:7777777777@192.168.30.254
Diversion: sip:2249@192.168.30.254;reason=unconditional
Server: Cisco/SPA504G-7.4.9a
Content-Length: 0

<------------->
— (10 headers 0 lines) —
– Got SIP response 302 “Moved Temporarily” back from 192.168.30.5:5060
RDNIS for this call is 2249 (reason unconditional)
Transmitting (no NAT) to 192.168.30.5:5060:
ACK sip:2249@192.168.30.5:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.30.254:5060;branch=z9hG4bK110484d6
Max-Forwards: 70
From: sip:9999999999@192.168.30.254;tag=as28c5f89e
To: sip:2249@192.168.30.5:5060;tag=9f17882ffc944365i0
Contact: sip:9999999999@192.168.30.254:5060
Call-ID: 6a45e4e97a49984b69df5aec792b2206@192.168.30.254:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 11.8.1
Content-Length: 0


-- Now forwarding DAHDI/i2/9999999999-2559 to 'Local/7777777777@directdial' (thanks to SIP/2249-00002bac)

[Jan 15 12:26:06] NOTICE[1467][C-00002d6d]: app_dial.c:958 do_forward: Not accepting call completion offers from call-forward recipient Local/7777777777@directdial-00000061;1
– Executing [7777777777@directdial:1] Set(“Local/7777777777@directdial-00000061;2”, “CALLERID(num)=694339999999999”) in new stack
– Executing [7777777777@directdial:2] NoOp(“Local/7777777777@directdial-00000061;2”, “694339999999999”) in new stack
– Executing [7777777777@directdial:3] Dial(“Local/7777777777@directdial-00000061;2”, “dahdi/i2/7777777777,120,txX”) in new stack
– Requested transfer capability: 0x00 - SPEECH
– Called dahdi/i2/7777777777
Really destroying SIP dialog ‘6a45e4e97a49984b69df5aec792b2206@192.168.30.254:5060’ Method: INVITE
– DAHDI/i2/7777777777-255a is proceeding passing it to Local/7777777777@directdial-00000061;2
– Local/7777777777@directdial-00000061;1 is proceeding passing it to DAHDI/i2/9999999999-2559
– Span 2: Channel 0/2 got hangup request, cause 1
– Hungup ‘DAHDI/i2/7777777777-255a’
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [7777777777@directdial:4] Log(“Local/7777777777@directdial-00000061;2”, “NOTICE, Dialing out from “” <694339999999999> to 7777777777 through pri 3”) in new stack
[Jan 15 12:26:06] NOTICE[1468][C-00002d6d]: Ext. 7777777777:4 @ directdial: Dialing out from “” <694339999999999> to 7777777777 through pri 3
– Auto fallthrough, channel ‘Local/7777777777@directdial-00000061;2’ status is ‘CHANUNAVAIL’
– Local/7777777777@directdial-00000061;1 is circuit-busy
== Everyone is busy/congested at this time (1:0/1/0)
– Auto fallthrough, channel ‘DAHDI/i2/9999999999-2559’ status is ‘CONGESTION’
– Span 2: Channel 0/1 got hangup request, cause 16
– Hungup ‘DAHDI/i2/9999999999-2559’

Your PSTN provider rejected the call with cause 1. That is “unallocated or unassigned number”. You need to provide a valid number in the redirection.

Thanks David, you mean the originate CallerID or the destination number? I leave intact the logic for the outbound call:

exten => _3X.,1,Set(CALLERID(num)=pri_number_root${CALLERID(num)})
exten => _3X.,2,Noop(${CALLERID(num)})
exten => _3X.,3,Dial(dahdi/i2/${EXTEN},120,txX)
exten => _3X.,4,Log(NOTICE, Dialing out from ${CALLERID(all)} to ${EXTEN} through pri 3)
exten => _3X.,104,Hangup

this is use for mobile , do you think I need to change something?

thanks
Stefano

I mean 7777777777. The SIP device sent a request to forward the call to 7777777777, Asterisk interpreted that in the current context, and decided that it was a number on a DAHDI group. It called that number, and the FXO indicated that it was not a valid number.

If I’ve undertood the called number is used as internal extension and when it is passed to dahdi it was reject, right? there is a workaround to bypass this behaviour (is sip 302??)?

I think you want to enable promiscuous redirection, if you want a SIP URI received from a SIP endpoint, to be used as the target of a redirect.

NB This is not a work around, it is an alternative mode of operation.

probably is too complex for my knowledge, if you have an example , I can analyze it and replicate in my configuration.
Thanks David

Hi, anyone can suggest how to do this?

thanks
Stefano