Handling transfer from Microsoft Speech Server

I have the following setup:
VoIP Provider <=> Asterisk 1.6 <=> Microsoft Speech Server 2007

Asterisk/Speech Server are both behind a NAT and while Asterisk runs in a CentOS 5.2 VM (PBX-in-a-Flash 1.3).

I’m using Asterisk to simply handle incoming calls and transfers and to provide the TCP<=>UDP functionality for Speech Server). The dial plan I configured in extensions_custom.conf handles incoming calls from a phone number and transfer to Speech Server.

[incoming-calls] exten => PHONENUMBER,1,SIPAddHeader(Diversion: <tel:${EXTTOCALL}>\;reason=no-answer\;screen=no\;privacy=off) exten => PHONENUMBER,n,Dial(SIP/222@192.168.10.118) exten => PHONENUMBER,n,Hangup()

The Voice Response application on extension 222 of Speech Server does a blind transfer (for instance transfer to a customer service rep on extension 202 which is configured as softphone for now). The SIP URI I use is 202@192.168.10.60 on port 5060 (that is the IP of the Asterisk VM).

My question is how can I configure a dialplan to allow that transfer to the extension?

NOTE: I’ve replaced the VoIP public IP with “VOIP” and our phone number with “PHONENUMBER” in this post.

I see the following traffic in Wireshark:

No. Time Source Destination Protocol Info 56 13:17:45.620505 192.168.10.60 192.168.10.118 TCP 60943 > ca-1 [SYN] Seq=0 Win=5840 Len=0 MSS=1460 TSV=74989039 TSER=0 WS=6 57 13:17:45.620550 192.168.10.118 192.168.10.60 TCP ca-1 > 60943 [SYN, ACK] Seq=0 Ack=1 Win=16384 Len=0 MSS=1460 WS=0 TSV=0 TSER=0 58 13:17:45.620778 192.168.10.60 192.168.10.118 TCP 60943 > ca-1 [ACK] Seq=1 Ack=1 Win=5888 Len=0 TSV=74989041 TSER=0 59 13:17:45.621248 192.168.10.60 192.168.10.118 SIP/SDP Request: INVITE sip:222@192.168.10.118:5064, with session description 60 13:17:45.623507 192.168.10.118 192.168.10.60 SIP Status: 100 Trying 61 13:17:45.624099 192.168.10.60 192.168.10.118 TCP 60943 > ca-1 [ACK] Seq=970 Ack=285 Win=6912 Len=0 TSV=74989050 TSER=770271 63 13:17:45.626696 192.168.10.118 192.168.10.60 SIP Status: 180 Ringing 64 13:17:45.626959 192.168.10.60 192.168.10.118 TCP 60943 > ca-1 [ACK] Seq=970 Ack=623 Win=8000 Len=0 TSV=74989062 TSER=770271 68 13:17:45.728953 192.168.10.118 192.168.10.60 SIP/SDP Status: 200 OK, with session description 69 13:17:45.729987 192.168.10.60 192.168.10.118 TCP 60943 > ca-1 [ACK] Seq=970 Ack=1357 Win=9472 Len=0 TSV=74989147 TSER=770272 71 13:17:45.745730 192.168.10.60 192.168.10.118 SIP Request: ACK sip:asidsk016.asi.local:5064;transport=Tcp;maddr=192.168.10.118 84 13:17:45.890125 192.168.10.118 192.168.10.60 TCP ca-1 > 60943 [ACK] Seq=1357 Ack=1441 Win=64095 Len=0 TSV=770274 TSER=74989188 2080 13:17:55.975857 192.168.10.118 192.168.10.60 SIP Request: REFER sip:INTERNALPHONE@192.168.10.60:5060;transport=TCP 2081 13:17:55.976625 192.168.10.60 192.168.10.118 TCP 60943 > ca-1 [ACK] Seq=1441 Ack=1948 Win=10944 Len=0 TSV=74999419 TSER=770374 2082 13:17:55.978454 192.168.10.60 192.168.10.118 SIP Status: 202 Accepted 2091 13:17:56.149282 192.168.10.118 192.168.10.60 TCP ca-1 > 60943 [ACK] Seq=1948 Ack=1951 Win=65535 Len=0 TSV=770376 TSER=74999423 2092 13:17:56.149435 192.168.10.60 192.168.10.118 SIP/sipfrag Request: NOTIFY sip:asidsk016.asi.local:5064;transport=Tcp;maddr=192.168.10.118, with Sipfrag(SIP/2.0 200 Ok) 2093 13:17:56.150662 192.168.10.118 192.168.10.60 SIP Status: 200 OK 2094 13:17:56.191130 192.168.10.60 192.168.10.118 TCP 60943 > ca-1 [ACK] Seq=3338 Ack=2281 Win=12416 Len=0 TSV=74999635 TSER=770376 2095 13:17:56.191169 192.168.10.118 192.168.10.60 SIP Request: BYE sip:INTERNALPHONE@192.168.10.60:5060;transport=TCP 2096 13:17:56.191304 192.168.10.60 192.168.10.118 TCP 60943 > ca-1 [ACK] Seq=3338 Ack=2991 Win=13888 Len=0 TSV=74999636 TSER=770376

And in Asterisk CLI:

[Oct 16 12:59:27] VERBOSE[3405] chan_sip.c: -- Registered SIP '202' at 192.168.10.118 port 5060 expires 3600 [Oct 16 12:59:27] NOTICE[3405] chan_sip.c: Peer '202' is now Reachable. (25ms / 2000ms) [Oct 16 12:59:56] VERBOSE[3405] netsock.c: == Using SIP RTP TOS bits 184 [Oct 16 12:59:56] VERBOSE[3405] netsock.c: == Using SIP RTP CoS mark 5 [Oct 16 12:59:56] VERBOSE[7548] pbx.c: -- Executing [PHONENUMBER@incoming-calls:1] [1;36;40mSIPAddHeader [0;37;40m(" [1;35;40mSIP/VOIP-09343e80 [0;37;40m", " [1;35;40mDiversion: <tel:>\;reason=no-answer\;screen=no\;privacy=off [0;37;40m") in new stack [Oct 16 12:59:56] VERBOSE[7548] pbx.c: -- Executing [PHONENUMBER@incoming-calls:2] [1;36;40mDial [0;37;40m(" [1;35;40mSIP/VOIP-09343e80 [0;37;40m", " [1;35;40mSIP/222@192.168.10.118 [0;37;40m") in new stack [Oct 16 12:59:56] VERBOSE[7548] netsock.c: == Using SIP RTP TOS bits 184 [Oct 16 12:59:56] VERBOSE[7548] netsock.c: == Using SIP RTP CoS mark 5 [Oct 16 12:59:56] VERBOSE[7548] app_dial.c: -- Called 222@192.168.10.118 [Oct 16 12:59:56] VERBOSE[7506] chan_sip.c: -- Got SIP response 302 "Moved Temporarily" back from 192.168.10.118 [Oct 16 12:59:56] VERBOSE[7548] app_dial.c: -- Now forwarding SIP/VOIP-09343e80 to 'SIP/222::::TCP@192.168.10.118:5064' (thanks to SIP/192.168.10.118-0933d3f8) [Oct 16 12:59:56] VERBOSE[7548] netsock.c: == Using SIP RTP TOS bits 184 [Oct 16 12:59:56] VERBOSE[7548] netsock.c: == Using SIP RTP CoS mark 5 [Oct 16 12:59:56] VERBOSE[7548] app_dial.c: -- SIP/192.168.10.118:5064-0928a798 is ringing [Oct 16 12:59:57] VERBOSE[7548] app_dial.c: -- SIP/192.168.10.118:5064-0928a798 answered SIP/VOIP-09343e80 [Oct 16 12:59:57] VERBOSE[7548] rtp.c: -- Packet2Packet bridging SIP/VOIP-09343e80 and SIP/192.168.10.118:5064-0928a798 [Oct 16 13:00:03] VERBOSE[7548] pbx.c: -- Executing [h@from-internal-xfer:1] [1;36;40mMacro [0;37;40m(" [1;35;40mSIP/VOIP-09343e80 [0;37;40m", " [1;35;40mhangupcall [0;37;40m") in new stack [Oct 16 13:00:03] VERBOSE[7548] pbx.c: -- Executing [s@macro-hangupcall:1] [1;36;40mResetCDR [0;37;40m(" [1;35;40mSIP/VOIP-09343e80 [0;37;40m", " [1;35;40mw [0;37;40m") in new stack [Oct 16 13:00:03] VERBOSE[7548] pbx.c: -- Executing [s@macro-hangupcall:2] [1;36;40mNoCDR [0;37;40m(" [1;35;40mSIP/VOIP-09343e80 [0;37;40m", " [1;35;40m [0;37;40m") in new stack [Oct 16 13:00:03] VERBOSE[7548] pbx.c: -- Executing [s@macro-hangupcall:3] [1;36;40mGotoIf [0;37;40m(" [1;35;40mSIP/VOIP-09343e80 [0;37;40m", " [1;35;40m1?skiprg [0;37;40m") in new stack [Oct 16 13:00:03] VERBOSE[7548] pbx.c: -- Goto (macro-hangupcall,s,6) [Oct 16 13:00:03] VERBOSE[7548] pbx.c: -- Executing [s@macro-hangupcall:6] [1;36;40mGotoIf [0;37;40m(" [1;35;40mSIP/VOIP-09343e80 [0;37;40m", " [1;35;40m1?skipblkvm [0;37;40m") in new stack [Oct 16 13:00:03] VERBOSE[7548] pbx.c: -- Goto (macro-hangupcall,s,9) [Oct 16 13:00:03] VERBOSE[7548] pbx.c: -- Executing [s@macro-hangupcall:9] [1;36;40mGotoIf [0;37;40m(" [1;35;40mSIP/VOIP-09343e80 [0;37;40m", " [1;35;40m1?theend [0;37;40m") in new stack [Oct 16 13:00:03] VERBOSE[7548] pbx.c: -- Goto (macro-hangupcall,s,11) [Oct 16 13:00:03] VERBOSE[7548] pbx.c: -- Executing [s@macro-hangupcall:11] [1;36;40mHangup [0;37;40m(" [1;35;40mSIP/VOIP-09343e80 [0;37;40m", " [1;35;40m [0;37;40m") in new stack [Oct 16 13:00:03] VERBOSE[7548] app_macro.c: == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/VOIP-09343e80' in macro 'hangupcall' [Oct 16 13:00:03] VERBOSE[7548] features.c: == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/VOIP-09343e80' [Oct 16 13:00:03] VERBOSE[7548] pbx.c: == Spawn extension (macro-hangupcall, 202, 1) exited non-zero on 'SIP/VOIP-09343e80' [Oct 16 13:00:03] WARNING[7548] pbx.c: Channel 'SIP/VOIP-09343e80' sent into invalid extension '202' in context 'macro-hangupcall', but no invalid handler [Oct 16 13:00:25] VERBOSE[7504] asterisk.c: -- Remote UNIX connection disconnected