Set up PJSIP with AnveoDirect?

Based on your dial plan, you can’t expect asterisk to handle this as valid inbound-calls, if that is not on your INVITE request, which was your case. And it looks like, or you didn’t read the logs or there was a verbose problem, because if the issue was setting the correct extension, a message on the console should indicate it

So is my main problem fixed then? Or what else is wrong?

Because now when I call my DID, I hear moh, but after about 30 seconds, it hangs up in me.

    -- Executing [15551235555@from-siptrunk:1] Verbose("PJSIP/siptrunk-00000007", "1,Playing livestream.") in new stack
 Playing livestream.
    -- Executing [15551235555@from-siptrunk:2] Answer("PJSIP/siptrunk-00000007", "") in new stack
       > 0x7f3f240228c0 -- Strict RTP learning after remote address set to: 81.201.85.76:10542
    -- Executing [15551235555@from-siptrunk:3] MusicOnHold("PJSIP/siptrunk-00000007", "ulawstream") in new stack
    -- Started music on hold, class 'ulawstream', on channel 'PJSIP/siptrunk-00000007'
    -- Stopped music on hold on PJSIP/siptrunk-00000007
  == Spawn extension (from-siptrunk, 15551235555, 3) exited non-zero on 'PJSIP/siptrunk-00000007'

local_net=192.0.2.0/24

local_net=127.0.0.1/32

external_media_address=198.51.100.5

external_signaling_address=198.51.100.5

https://wiki.asterisk.org/wiki/display/AST/Configuring+res_pjsip+to+work+through+NAT

1 Like

But my Asterisk server isn’t behind a NAT? It’s on a GCP compute instance? Would this still even apply?

Run the ifconfig command and post the output

ens4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
        inet 10.142.0.3  netmask 255.255.255.255  broadcast 10.142.0.3
        ether 42:01:0a:8e:00:03  txqueuelen 1000  (Ethernet)
        RX packets 4684240  bytes 1906942617 (1.7 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3590308  bytes 466861097 (445.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 38  bytes 2476 (2.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 38  bytes 2476 (2.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

This is not a public IP, so NAT settings are needed

Yes, that is my GCP instance’s internal IP.

So I’m familiar with my home network internal IP being 192.168.1.1 or 182.168.0.1 or whatever, so how would an internal IP of 10.142.0.3 change things? Or would it?

External IP should be equal to what you get, when you run this command

curl ifconfig.co

It should also be what you get when you run:

dig A my.domain.com

as Anveo obviously managed to find it for the incoming INVITE.

Although you have now got past this point, you don’t add the INVITE. That comes from Anveo. You have to find it in the logs.

At this point I think I would note that you are probably scraping the log off the screen. You really need to go to logger.conf, uncomment the full log, issue “logger reload” at the Asterisk CLI prompt, and then look at /var/log/asterisk/full, for the log.

Thank you!!! It finally works and doesn’t hang up on me.

So now, under the [transport-udp] section in pjsip.conf, it looks like this (with 12.345.67.890 being my GCP public IP address):

type=transport
protocol=udp
bind=0.0.0.0:5060
local_net=10.142.0.3/32
external_media_address=12.345.67.890
external_signaling_address=12.345.67.890

As a note, I don’t really understand CIDR fully (the slash and numbers after the internal IP address I have there), so I used a CIDR calculator and entered 10.142.0.3 for the start and end IP address which gave me 10.142.0.3/32.

Glad it works, but just curious as I am not a network expert is this valid IP address ?

Well, no, it’s not a valid IP address. I just didn’t want to put my GCP instance’s public IP address out there on the world wide web for everyone to see. :wink:

Lol, now I understood

It appears that Google Cloud doesn’t use CIDR normally. Only the broadcast address is defined. /32 means all bits define the network, which is effectively true in that case. I believe, though, that the local interface network is treated as local_net without being explicitly declared. With that setup, I don’t think you are ever going to have an endpoint on the local_net, so it isn’t particularly important.

(A normal CIDR network would have /30 or less, and have at least four addresses: the network address, two normal addresses, and the broadcast address.)

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