SIP Trunk Same Host Different Ports

Hi Guys,

I am setting up a SIP Trunk between FreePBX and CUCM 4.2 to use as an IVR and an announcement. Simple setup, call comes in from cisco H.323 gateway, SIP connection setup from gateway to FreePBX, inbound route directs the call based on DID to the IVR. User selects the option on the IVR and the Extension is passed to an Outbound Route to the Call Manager Trunk. This bit is working fine. The Call Managers incoming UDP Port for the Trunk is set to 5097 as we have a number of SIP Trunks defined in Call Manager so this needs to be unique on CUCM. Have setup a corresponding peer on FreePBX that defines that host and port as 5097. As I said this works.
Now what I want to do is setup an announcement so that Call Manager can direct a call to the FreePBX box. I have setup an inbound route on a different DID which has its destination set as my announcement. Call Manager wants to communicate with FreePBX using the default port 5060. All I get is “All circuits are busy now, please try again later”.
I have tried creating two trunks to the same host on FreePBX, one using Port 5060 and the other 5097, this didn’t work. I have tried setting the User Context on the same trunk to port 5060 and the Peer Details to 5097, this didnt work. I have also tried setting both Ports on the Call Manager Trunk to 5097, that doesn’t even pass the call to the FreePBX box, however, if I configure the SIP Bind Port to 5097 it does then pass the call, but I still get the message "All circuits are busy …"
The only time I got the announcment to work was when I took out the port=5097 statement on the main Trunk Peer. Then the announcement worked, but the IVR didn’t.
So how do I setup FreePBX to be able to receive incoming calls from CUCM on port 5060 and send calls to CUCM on Port 5097?

Here are some log output from one of my latest calls, it always says that there is congestion and the FreePBX Status screen shows about 10 active calls and high CPU even though it is the only call going through at that time.

[2013-05-23 11:57:58] VERBOSE[9680][C-000002b4] chan_sip.c: – Got SIP response 500 “Internal Server Error” back from 10.0.2.60:5097
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] app_dial.c: – SIP/fmbrmccm-00000542 is circuit-busy
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] app_dial.c: == Everyone is busy/congested at this time (1:0/1/0)
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Executing [s@macro-dialout-trunk:23] NoOp(“SIP/fmbrmccm-00000541”, “Dial failed for some reason with DIALSTATUS = CONGESTION and HANGUPCAUSE = 38”) in new stack
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Executing [s@macro-dialout-trunk:24] GotoIf(“SIP/fmbrmccm-00000541”, “0?continue,1:s-CONGESTION,1”) in new stack
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Goto (macro-dialout-trunk,s-CONGESTION,1)
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Executing [s-CONGESTION@macro-dialout-trunk:1] Set(“SIP/fmbrmccm-00000541”, “RC=38”) in new stack
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Executing [s-CONGESTION@macro-dialout-trunk:2] Goto(“SIP/fmbrmccm-00000541”, “38,1”) in new stack
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Goto (macro-dialout-trunk,38,1)
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Executing [38@macro-dialout-trunk:1] Goto(“SIP/fmbrmccm-00000541”, “continue,1”) in new stack
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Goto (macro-dialout-trunk,continue,1)
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Executing [continue@macro-dialout-trunk:1] NoOp(“SIP/fmbrmccm-00000541”, “TRUNK Dial failed due to CONGESTION HANGUPCAUSE: 38 - failing through to other trunks”) in new stack
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Executing [continue@macro-dialout-trunk:2] Set(“SIP/fmbrmccm-00000541”, “CALLERID(number)=”) in new stack
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Executing [8504201@from-internal:6] Macro(“SIP/fmbrmccm-00000541”, “outisbusy,”) in new stack
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Executing [s@macro-outisbusy:1] Progress(“SIP/fmbrmccm-00000541”, “”) in new stack
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] pbx.c: – Executing [s@macro-outisbusy:2] Playback(“SIP/fmbrmccm-00000541”, “all-circuits-busy-now,noanswer”) in new stack
[2013-05-23 11:57:58] VERBOSE[14323][C-000002b4] file.c: – <SIP/fmbrmccm-00000541> Playing ‘all-circuits-busy-now.alaw’ (language ‘en’)

Any help greatly appreciated.

Hi Guys,

Since the above post it seems that I managed to get my system into a routing loop, the call was coming in and it was trying to pass the call back out to the Call Manager which was passing it back again. So the log files above probably show this. However, even though I have fixed that I still appear to have to problem with communicating on the correct port. This is what I get now when I try to call the FreePBX box from Call Manager. Nothing really useful by the looks of it.

[2013-05-23 13:48:14] VERBOSE[15387][C-0000036c] pbx.c: – Executing [4201@from-internal:1] ResetCDR(“SIP/fmbrmcucmin-000006a1”, “”) in new stack
[2013-05-23 13:48:14] VERBOSE[15387][C-0000036c] pbx.c: – Executing [4201@from-internal:2] NoCDR(“SIP/fmbrmcucmin-000006a1”, “”) in new stack
[2013-05-23 13:48:14] VERBOSE[15387][C-0000036c] pbx.c: – Executing [4201@from-internal:3] Progress(“SIP/fmbrmcucmin-000006a1”, “”) in new stack
[2013-05-23 13:48:14] VERBOSE[15387][C-0000036c] pbx.c: – Executing [4201@from-internal:4] Wait(“SIP/fmbrmcucmin-000006a1”, “1”) in new stack
[2013-05-23 13:48:15] VERBOSE[15387][C-0000036c] pbx.c: – Executing [4201@from-internal:5] Progress(“SIP/fmbrmcucmin-000006a1”, “”) in new stack
[2013-05-23 13:48:15] VERBOSE[15387][C-0000036c] pbx.c: – Executing [4201@from-internal:6] Playback(“SIP/fmbrmcucmin-000006a1”, “silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer”) in new stack
[2013-05-23 13:48:15] VERBOSE[15387][C-0000036c] file.c: – <SIP/fmbrmcucmin-000006a1> Playing ‘silence/1.alaw’ (language ‘en’)
[2013-05-23 13:48:16] VERBOSE[15387][C-0000036c] file.c: – <SIP/fmbrmcucmin-000006a1> Playing ‘cannot-complete-as-dialed.alaw’ (language ‘en’)
[2013-05-23 13:48:16] VERBOSE[15387][C-0000036c] pbx.c: == Spawn extension (from-internal, 4201, 6) exited non-zero on ‘SIP/fmbrmcucmin-000006a1’
[2013-05-23 13:48:16] VERBOSE[15387][C-0000036c] pbx.c: – Executing [h@from-internal:1] Hangup(“SIP/fmbrmcucmin-000006a1”, “”) in new stack
[2013-05-23 13:48:16] VERBOSE[15387][C-0000036c] pbx.c: == Spawn extension (from-internal, h, 1) exited non-zero on ‘SIP/fmbrmcucmin-000006a1’

Thanks