Link to home
Start Free TrialLog in
Avatar of pacocaceres
pacocaceresFlag for Puerto Rico

asked on

cisco router sip to elastix 2 sip server

Hi,

We are trying to use a cisco 5300 router as an extension of our current PBX (coral) to be able to make outgoing calls through our elastix sip server.  The IOS version of the router is Cisco Internetwork Operating System Software IOS (tm) 5300 Software (C5300-IS-M), Version 12.3(13), RELEASE SOFTWARE (fc2)

On the Elastix server we created a generic extension without secret and providing the ip address of the cisco router in the host area. Please note that this IOS doesn't have authentication options on the sip-ua area.  On the cisco router we configured the dial-peer as follows:

dial-peer voice 1 voip
 destination-pattern 787.......$
 translate-outgoing calling 1
 voice-class codec 1
 voice-class h323 1
 session protocol sipv2
 session target ipv4:elastixipaddress
 tech-prefix 1
 dtmf-relay rtp-nte h245-alphanumeric
 ip qos dscp cs5 media
no vad

When we try to place a call we are getting the following int the asterisk CLI:

Verbosity is at least 5
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
    -- Executing [9399408189@from-sip-external:1] NoOp("SIP/199.x.x.x 2-0000005b", "Received incoming SIP connection from unknown peer to 939XXXXXXXX") in new stack

And a noservice message is heard by the user when trying to call.

My question is what is the correct configuration on the elastix extension side to be able to permit calls from the cisco router?



Avatar of Member_2_1968385
Member_2_1968385
Flag of United Kingdom of Great Britain and Northern Ireland image

First, I know plenty about Asterisk/Elastix, but almost nothing about Cisco.

The CLI messages simply show that Asterisk does not recognise the source address for the SIP request coming from the router. Check the list of known peers using this CLI command:
sip show peers

I believe you may have to set up the connection using a Trunk on Elastix, not an extension. That is because you need the sip peer to have the following parameters:
type=peer
insecure=invite
host=<ip-of-cisco-router>

I don't think you can have insecure=invite in an extension.

If you do have to set it up as a trunk in Elastix, then it gets a bit complicated to allow outbound calls. See this earlier question:
https://www.experts-exchange.com/questions/24917262/Route-calls-to-Trunk.html
ASKER CERTIFIED SOLUTION
Avatar of Member_2_1968385
Member_2_1968385
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pacocaceres

ASKER

Thanks for your reply,

Ok, in the extension I have created for this I know have:

type=peer
context=from-internal
host= the ip of the router

But I dont see insecure in that area. Note that Iam using the web interface on the extensions area. Let me know if this is something I have to configure elsewhere.

Thanks
Francisco
Please read carefully the comments that are posted - I already explained all that. Use a Trunk, not an extension.
Sorry for that, was reading to fast.
Ok, Iam new with elastix, so there are a lot of things that I may not know. Could you please specify where do I put this configuration? In the trunk area I have Outgoing settings and Incoming settings. The outgoing settings ask for a trunk name and then the blank box, in the incoming settings it asks for the User Context then a blank box. After that I have the register string, not sure if needed in this scenario.

If you offered more than 125 points, I would be *much* more patient!! (Just joking, but please don't read too fast).

You don't need a register string.
To keep things simple, you can put the same details in the Outgoing settings box and the Incoming settings box.
For Trunk name, put "cisco"; For User Context put "cisco-in" (These names are arbitrary).

There are a number of parameters that can be added to these boxes, but you must have a minimum of:
type=peer
context=from-internal
insecure=invite
host=<ip-of-cisco-router>

It is possible that from-internal will not work. Usually, this would be context=from-trunk, but then you would need to define an inbound route and usually inbound routes cannot make outbound calls - they do things like ringing extensions, going to IVR's, going to voicemail, etc. You might need to look up that old question I gave a link to earlier - it explains how to make an inbound route dial an external number.

Other parameters to consider include:
disallow and allow - these control which codecs it will use
dtmfmode - controls how it expects DTMF tones to be sent
qualify - controls if Asterisk should constantly test the connection using an OPTIONS ping
fromdomain - sets the domain part of the From header
etc, etc, etc - go and look them up at http://www.voip-info.org/wiki/view/Asterisk+config+sip.conf
Thanks for your patience. Ok so far I have done the following:

1. Created a sip trunk
2. Put the following parameters (view screencast)

When I tried to place a call from the behind the cisco I get the following in the asterisk cli:

-- Executing [787XXXXXXX@from-sip-external:1] NoOp("SIP/X.X.X.X-00000                                                                             06b", "Received incoming SIP connection from unknown peer to 787XXXXXXX") in new                                                                              stack
    -- Executing [787XXXXXXX@from-sip-external:2] Set("SIP/X.X.X.X-000000                                                                             6b", "DID=787XXXXXXX") in new stack
    -- Executing [787XXXXXXX@from-sip-external:3] Goto("SIP/X.X.X.X-00000                                                                             06b", "s,1") in new stack
    -- Goto (from-sip-external,s,1)
    -- Executing [s@from-sip-external:1] GotoIf("SIP/X.X.X.X-0000006b", "                                                                             0?checklang:noanonymous") in new stack
    -- Goto (from-sip-external,s,5)
    -- Executing [s@from-sip-external:5] Set("SIP/X.X.X.X-0000006b", "TIM                                                                             EOUT(absolute)=15") in new stack
Channel will hangup at 2011-03-31 14:11:24.951 AST.
    -- Executing [s@from-sip-external:6] Answer("SIP/X.X.X.X-0000006b", "                                                                             ") in new stack
    -- Executing [s@from-sip-external:7] Wait("SIP/X.X.X.X-0000006b", "2"                                                                             ) in new stack
    -- Executing [s@from-sip-external:8] Playback("SIP/X.X.X.X-0000006b",                                                                              "ss-noservice") in new stack
    -- <SIP/X.X.X.X-0000006b> Playing 'ss-noservice.gsm' (language 'en')
    -- Executing [s@from-sip-external:9] PlayTones("SIP/X.X.X.X-0000006b"                                                                             , "congestion") in new stack
    -- Executing [s@from-sip-external:10] Congestion("SIP/X.X.X.X-0000006                                                                             b", "5") in new stack
  == Spawn extension (from-sip-external, s, 10) exited non-zero on 'SIP/X.X.X.X-0000006b'
    -- Executing [h@from-sip-external:1] Hangup("SIP/X.X.X.X-0000006b", "                                                                             ") in new stack
  == Spawn extension (from-sip-external, h, 1) exited non-zero on 'SIP/X.X.X.X-0000006b'

What could I try next?

Thanks
Francisco
pacocaceres-439084.flv
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok that definitively worked because now Iam not getting the unknown peer error on the asterisk cli. Also if I call my cel phone from there I see the call but it hangs. Here is what Iam seeing now in the asterisk -r CLI:

 -- SIP/voippr-000000ae answered SIP/199.X.X.X-000000ad
    -- Native bridging SIP/199.X.X.X-000000ad and SIP/voippr-000000ae
    -- Got SIP response 420 "Bad Extension" back from 199.X.X.X
    -- Executing [h@macro-dialout-trunk:1] Macro("SIP/199.X.X.X-000000ad",                                                                              "hangupcall,") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("SIP/199.X.X.X-000000ad", "1                                                                             ?noautomon") in new stack
    -- Goto (macro-hangupcall,s,3)
    -- Executing [s@macro-hangupcall:3] NoOp("SIP/199.X.X.X-000000ad", "TOU                                                                             CH_MONITOR_OUTPUT=") in new stack
    -- Executing [s@macro-hangupcall:4] GotoIf("SIP/199.X.X.X-000000ad", "1                                                                             ?noautomon2") in new stack
    -- Goto (macro-hangupcall,s,6)
    -- Executing [s@macro-hangupcall:6] NoOp("SIP/199.X.X.X-000000ad", "MON                                                                             ITOR_FILENAME=") in new stack
    -- Executing [s@macro-hangupcall:7] GotoIf("SIP/199.X.X.X-000000ad", "1                                                                             ?skiprg") in new stack
    -- Goto (macro-hangupcall,s,10)
    -- Executing [s@macro-hangupcall:10] GotoIf("SIP/199.X.X.X-000000ad", "                                                                             1?skipblkvm") in new stack
    -- Goto (macro-hangupcall,s,13)
    -- Executing [s@macro-hangupcall:13] GotoIf("SIP/199.X.X.X-000000ad", "                                                                             1?theend") in new stack
    -- Goto (macro-hangupcall,s,15)
    -- Executing [s@macro-hangupcall:15] Hangup("SIP/199.X.X.X-000000ad", "                                                                             ") in new stack
  == Spawn extension (macro-hangupcall, s, 15) exited non-zero on 'SIP/199.X.X.X-000000ad' in macro 'hangupcall'
  == Spawn extension (macro-dialout-trunk, s, 19) exited non-zero on 'SIP/199.X.X.X-000000ad' in macro 'dialout-trunk'
  == Spawn extension (from-internal, 787485XXXX, 4) exited non-zero on 'SIP/199.X.X.X-000000ad'

What is missing so I can succefully place calls?
I do appreciate all your help Feptias :)

Thanks
Francisco
It is probably the formatting of the number does not match an outbound route. It looks like the number is 787485XXXX.

You must have an Outbound Route defined in Asterisk with the Dial Pattern matching the format of the numbers that it is receiving from the cisco router and with the first entry in Trunk Sequence set to be the tampa.voip trunk that you want the calls to go out through.
I configured the outbound route, the number 787485 was the one I was calling. Here is what Iam seeing right now:

1. I can place the call
2. rings on the other side but when I answer the call it gets disconnected
Here is the error I see on the CLI:

 SIP/ara-voipms-000000c8 answered SIP/ciscoara-000000c7
    -- Native bridging SIP/ciscoara-000000c7 and SIP/ara-voipms-000000c8
    -- Got SIP response 420 "Bad Extension" back from 199.255.X.X

What means this error 420 Bad Extension? could be a configuration on the cisco side? Here is the peer configuration on the cisco side:

dial-peer voice 2 voip
 destination-pattern 787.......$
 translate-outgoing calling 1
 voice-class codec 1
 voice-class h323 1
 session protocol sipv2
 session target ipv4:199.255.X.X
 session transport udp
 tech-prefix 1
 dtmf-relay rtp-nte h245-alphanumeric
 ip qos dscp cs5 media
 no vad

Thanks
Francisco
The combination is illogical (a) the destination phone rings and (b) 420 Bad Extension. That doesn't make sense. What exactly do you mean by "rings on the other side"?

Who or what is returning "420 Bad Extension"? What is at 199.255.X.X?

I would guess that your voip service provider does not expect to receive numbers in the format you are sending. I am not familiar with USA telephone number formats, but maybe there are various ways the number can be sent to your provider - like with a 1 at the beginning, or with 001 at the beginning. Have you checked with your provider to find out what numbering format they want?

Can you make a call directly from your Elastix server to the same destination? Do you have a handset connected directly to the Elastix server?
I make a call to 787485XXXX ( this is my cel phone) my cel phone rings but when I answer it hangs up. I beleive this means that the call is reaching my phone, but as soon as I answer it hangs. In the asterisk I see the error I typed in my last message. The ip 199.255.X.X is the ip address of the Cisco Router.  I can place calls with other phones connected to the asterisk, this is only happening when I try to place a call using the cisco router.
Can you add more codecs to the Cisco config? Perhaps there is no compatible codec between the two endpoints.

If codecs doesn't fix it, I will need to see a packet trace for all the SIP messages going between the Elastix server and the service provider when you make a call. Are you able to use tethereal/Wireshark on the Elastix server? An alternative is the sip debug options on Elastix. For example, "sip set debug" or "sip set debug on" at the CLI will start showing all the SIP messages. "sip set debug off" to disable the option. There is also "sip set debug peer <peername>" which will enable debug just for the specified peer.

It will be a lot of messages. You'll need to cpature it to a file and post back here as an attachment.
Hope this make more sense to you:

Audio is at 199.X.ASTERISKIP port 17774
Adding codec 0x4 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP

<--- Reliably Transmitting (no NAT) to 199.X.CISCOIP:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP  199.X.CISCOIP:5060;received=199.X.CISCOIP
From: "7877636310" <sip:7877636310@199.X.CISCOIP>;tag=31BAA01C-1855
To: <sip:9396397475@199.X.ASTERISKIP>;tag=as5b0affe9
Call-ID: B237E98D-5BBB11E0-B510C9F8-7BB20017@199.X.CISCOIP
CSeq: 101 INVITE
Server: FPBX-2.7.0(1.6.2.13)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Require: timer
Session-Expires: 1800;refresher=uas
Contact: <sip:9396397475@199.X.ASTERISKIP>
Content-Type: application/sdp
Content-Length: 239

v=0
o=root 1695051100 1695051101 IN IP4 199.X.ASTERISKIP
s=Asterisk PBX 1.6.2.13
c=IN IP4 199.X.ASTERISKIP
t=0 0
m=audio 17774 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

<------------>
    -- Native bridging SIP/199.X.CISCOIP-000000e4 and SIP/voippr-000000e5
set_destination: Parsing <sip:7877636310@199.X.CISCOIP:5060> for address/port to send to
set_destination: set destination to 199.X.CISCOIP, port 5060
Audio is at 199.X.ASTERISKIP port 17774
Adding codec 0x4 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 199.X.CISCOIP:5060:
INVITE sip:7877636310@199.X.CISCOIP:5060 SIP/2.0
Via: SIP/2.0/UDP 199.X.ASTERISKIP:5060;branch=z9hG4bK5a04ffd4;rport
Max-Forwards: 70
From: <sip:9396397475@199.X.ASTERISKIP>;tag=as5b0affe9
To: "7877636310" <sip:7877636310@199.X.CISCOIP>;tag=31BAA01C-1855
Contact: <sip:9396397475@199.X.ASTERISKIP>
Call-ID: B237E98D-5BBB11E0-B510C9F8-7BB20017@199.X.CISCOIP
CSeq: 102 INVITE
User-Agent: FPBX-2.7.0(1.6.2.13)
Require: timer
Session-Expires: 1800;refresher=uas
Min-SE: 90
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
X-asterisk-Info: SIP re-invite (External RTP bridge)
Content-Type: application/sdp
Content-Length: 239

v=0
o=root 1695051100 1695051102 IN IP4 68.233.SIPPROVIDER
s=Asterisk PBX 1.6.2.13
c=IN IP4 68.233.SIPPROVIDER
t=0 0
m=audio 10654 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---

<--- SIP read from UDP:199.X.CISCOIP:5060 --->
SIP/2.0 420 Bad Extension
Via: SIP/2.0/UDP 199.X.ASTERISKIP:5060;branch=z9hG4bK5a04ffd4;rport
From: <sip:9396397475@199.X.ASTERISKIP>;tag=as5b0affe9
To: "7877636310" <sip:7877636310@199.X.CISCOIP>;tag=31BAA01C-1855
Call-ID: B237E98D-5BBB11E0-B510C9F8-7BB20017@199.X.CISCOIP
CSeq: 102 INVITE
Unsupported: timer
Content-Length: 0


<------------->
--- (8 headers 0 lines) ---
    -- Got SIP response 420 "Bad Extension" back from 199.X.CISCOIP
set_destination: Parsing <sip:7877636310@199.X.CISCOIP:5060> for address/port to send to
set_destination: set destination to 199.X.CISCOIP, port 5060
Transmitting (no NAT) to 199.X.CISCOIP:5060:
ACK sip:7877636310@199.X.CISCOIP:5060 SIP/2.0
Via: SIP/2.0/UDP 199.X.ASTERISKIP:5060;branch=z9hG4bK5a04ffd4;rport
Max-Forwards: 70
From: <sip:9396397475@199.X.ASTERISKIP>;tag=as5b0affe9
To: "7877636310" <sip:7877636310@199.X.CISCOIP>;tag=31BAA01C-1855
Contact: <sip:9396397475@199.X.ASTERISKIP>
Call-ID: B237E98D-5BBB11E0-B510C9F8-7BB20017@199.X.CISCOIP
CSeq: 102 ACK
User-Agent: FPBX-2.7.0(1.6.2.13)
Content-Length: 0
Try adding "canreinvite=no" to the Perr Details and User Details of the Cisco trunk definition.
I think it may be something with the codecs. What is the correct format for g729, g711 and any other? just to accept all of the codecs.
allow=all    or    allow=ulaw,alaw,g729,gsm....

However, the list of allowed codecs should match the actual codecs supported by the end point, otherwise you may tell Asterisk to select a codec that the end point cannot use.

I know nothing about cisco, but could it be the line "voice-class=h323 1" that is the cause of the problem? H323 is a different protocol to SIP.

Did you add the line I suggested? - canreinvite=no
The error is happening when Asterisk sends a re-invite. If you stop it sending one, then the error may go. (BTW, in my last post it should say Peer Details, not Perr Details)
I finally connected the cisco router to a sip server from another provider and it worked. Dont really know what was the configuration of their server because I dont have access to it. The last solutions helped a lot and I appreciate the help but it did not solved the problem on the asterisk server I was trying.
And yes I did try all the options mentioned above. Will try again some other day, for now I cant doit because the cisco is already in production.

Thanks
The help provided was very good, but it did not help me solve the problem.
Sorry we couldn't drill down to the exact cause of the problem - I would be much happier to know the cause of that "420 Bad Extension" because it is not an error that I remember seeing before - knowing the cause and the solution would be very useful in case I ever see it again. Please post back here if you do learn more.

Thanks for closing the question.