Asterisk PJSIP configuration file for GSM gate - GoIP 8

I can not find a normal manual for a pure pjsip asterisk + goip gsm gateway , a lot of very old documentation for sip or work with freepbx. Both devices are on the local network and there is no NAT between them. Asterisk local ip 192.168.0.10 and gsm goip 192.168.0.20

pjsip.conf

[udp-transport-1]
type=transport
protocol=udp
bind=0.0.0.0:5060

//Endpoint account for zoiper softphone
[401]
type=endpoint
transport=udp-transport-1
context=default
disallow=all
allow=alaw
aors=401
auth=401
callerid=John<401>

[401]
type=aor
max_contacts=1
remove_existing=yes
;qualify_frequency=60

[401]
type=auth
auth_type=userpass
password=123456789
username=401


//Endpoint account for goip8 gateway on sim slot #1
[sim1]
type=endpoint
transport=udp-transport-1
context=default
disallow=all
allow=alaw
aors=sim1
auth=sim1



[sim1]
type=aor
max_contacts=1
remove_existing=yes


[sim1]
type=auth
auth_type=userpass
password=sim1
username=sim1

extensions.conf

//just for the test, so that the call from the gsm gateway comes to the asterisk
[default]
exten => sim1, 1, Playback(hello-world)

but during a call from a mobile phone to an asterisk I get an error

[Jun 19 00:15:24] NOTICE[26607]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'INVITE' from '"+PHONE_NUMBER" <sip:+PHONE_NUMBER@192.168.0.10>' failed for '192.168.0.20:5060' (callid: 553658293@192.168.0.20) - No matching endpoint found
[Jun 19 00:15:24] NOTICE[26607]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'INVITE' from '"+PHONE_NUMBER" <sip:+PHONE_NUMBER@192.168.0.10>' failed for '192.168.0.20:5060' (callid: 553658293@192.168.0.20) - Failed to authenticate

I have a few GOIP boxes that are successfully working with PJSIP.

Here are the steps to set it up:

  1. Create a PJSIP endpoint.
  2. Register the GOIP to Asterisk using the endpoint credentials that were created in step 1.
  3. Write a dial plan to handle sending and receiving calls through that endpoint.

By following these steps, you should be able to configure your GOIP boxes to work seamlessly with PJSIP in Asterisk.

you chatGPT?

If it supports it, your easiest option is use a static IP address, and identify by address, rather than user name. You might be able to identify by authuser, but if doing so, please read the cautions about doing so.

Thanks for the idea, this is my first install of asterisk, but if I understand correctly then my GoIP gateway registers correctly on the asterisk server, this can be seen pjsip show endpoints. I have endpoint sim1 Maybe the problem is in the dialplan, I receive incoming calls from the gateway in this way

exten => sim1, 1, Playback(hello-world)

The problem is clearly that the gateway is sending the caller ID and not its account name in the From header. That is the basis on which I made my suggestions.

It is identifying itself as the external caller, not as sim1, for incoming calls, even if it is registering with sim1 in the From header. Your choices are:

  • match it by IP address, in which case there is no point in its registering as you already know the address;

  • make it send sim1 in the From header, which might not be possible (which is why I didn’t list it above - it would also mean you had to select another means of providing the caller ID);

  • match it by the authorisation user ID, which is messy, because you have to take steps to avoid a security warning on the first INVITE attempt.

1 Like

Thank you so much! Use CID as Sip caller ID so it was configured on the GoIP8. This can be turned off, but I would like to see the incoming number.

Added a section in pjsip.conf for authorization by ip and not login

[sim1]
type=identify
endpoint=sim1
match=192.168.0.20

I also added additional acl section but it does not work, it is not clear why it is so confusingly implemented, it took a lot of time to figure it out. Thanks again!

Discussed error occurs during error in extension.conf
For dialing to GSM via GoIP you must write: Dial(PJSIP/${EXTEN}@sim1) not as Dial(SIP/sim1/${EXTEN})

Working example for GoIP1 is:
exten => _.,1,Dial(PJSIP/${EXTEN}@goip)
same = n,Hangup()

where goip is endpoint configured as u write in first post.
For more info see https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=26476603

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.