Asterisk - OpenSIPS integration

Hi, I am trying to integrate OpenSIPS with Asterisk for playing media and IVR treatment. Below is the copy of the sip.conf file and extensions.conf. When i dial 12345 from my softphone (Bria), the call drops without playing the media file in asterisk which is the expected outcome. I am seeing 401 unauthorized message in the asterisk console when the invite is sent. Any help would be appreciated ? Thank you





exten => 12345,1,Answer
exten => 12345,n,NoOp(OpenSIPS-Integration)
exten => 12345,n,playback(demo-thanks)
exten => 12345,n,Hangup()

Do you have type=friend entries and do the names of any of them match the user part of the requests you are receiving? (Most configurations don’t need. and therefore should not use, type=friend.)

Are you sure you have the right host address?

401 means it is matching a sip.conf entry that doesn’t have insecure=invite, and does have a secret, or it is not matching any, and you have always auth reject. Actually insecure=invite has no effect if there is no secret. 401 is a request to authenticate.

Thank you david. I did check and there are no type=friend entries. The host address was also checked, it is correct. Not sure if there is another type of configuration that is not correct.

I was able to go a step further today but found an interesting problem with Asterisk. This is my setup - 2 endpoints (softphones) registered to OpenSIPS. I call a specific number which would route the call to Asterisk for playing a simple media file and hang-up. My sip and extension conf entries are as stated above. Asterisk answers the call which is clear from the real-time traces (sip debug) and comes up with the error message "extension rejected because it is not found in context ". I can confirm it is in the context. I tried to check if the number <12345> is getting recognized by the dialplan using the show dialplan context command which failed for this specific context and also for all contexts that existed wihch was quite strange. Can someone help ? Is it a corrupt extension.conf file? Thank you

You’d need to provide exactly what the message says.

The exact error message when i dial the configured number is

“Failed to establish call - number not found”

I meant the error message in Asterisk and the console output. Also the SIP trace.

sip trace.txt (14.8 KB)

You have a NAT/network/firewall issue. The chan_sip module is sending a 200 OK and not receiving the ACK for it. It has stated that it expects its response at port 5060.

If it is a network/firewall/NAT then it has to be for all traffic not specific to this transaction right ?

I can only comment on the specific trace you’ve provided, and what is happening, and what is commonly the cause of such a problem.

I have tested with disabling the firewall but the issue still persists.

I have a similar setup working, from the sip trace logs you have NAT issues with the network.

Retransmitting #1 (no NAT) to, resolve this issue, you should be fine.

you can try NAT options if that is resolving? maybe nat=force_rport? in general column.

Thank you all for the responses. The issue was not with the NAT or any setup in asterisk. The dialed number had to be managed in opensips so it could understand it as a simple dialed number and not a registered endpoint. As a workaround i registered an endpoint with the dialed number say 12345 and tested, it works as expected. I will handle this in the opensips script so it would not check registrations for further action. Thank you