Asterisk 18 and Linphones not calling eachother internally or from behind vpn

So i have two Android Phones using Linphone and they are Registered on my Asterisk Server and connected.
I cannot make calls?
if I connect locally via my phones to the server or use VPNS and connect externally I still cant make calls!

What do you mean by connected?

Please provide logging showing Asterisk rejecting the call (otherwise the presumption is that the fault lies outside Asterisk).

I have change my sip.conf and pjsip.conf to the basics from asterisk wiki and made the extensions.conf file as well

Now I am getting a debugging error that says extension 6002 rejecdted because extension not found in context ‘default’

Is 6002 in default? If so please provide the default context.

Is default the context in the sip.conf or pjsip.conf entry that should match? If so provide the parts of the configuration file that should cause it to be associated with the call and the source IP address, From header and authentication user (depending on how the match is supposed to be made) from the actual request.

I placed the 6002 in default in extensions and it worked, the calls were made, now trying to get video.

Still cant get video to work, the docs say it works by default?

Have you allowed video codecs?

Is video included in the initial SDP offer?

Here is my sip.conf

[general]
udpbindaddr=10.1.1.18:5062
transport=udp
videosupport=yes
allow=h263
allow=h263p
allow=h264

general
videosupport=yes
allow=h263
allow=h263p
allow=h264

friends_internal
type=friend
host=dynamic
context=from-internal
disallow=all
allow=ulaw

sorcerer
secret=xxxxxxxx ; put a strong, unique password here instead

turnip
secret=xxxxxxxx ; put a strong, unique password here instead

and pjsip.conf

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

;Templates for the necessary config sections

endpoint_internal
type=endpoint
context=from-internal
disallow=all
allow=ulaw

auth_userpass
type=auth
auth_type=userpass

aor_dynamic
type=aor
max_contacts=1

;Definitions for our phones, using the templates above

sorcerer
force_rport=yes
rtp_symetric=yes
allow=h263,h263p,h264
auth=sorcerer
aors=sorcerer
sorcerer
password=xxxxxxxx ; put a strong, unique password here instead
username=sorcerer
sorcerer

turnip
force_rport=yes
rtp_symetric=yes
allow=h263,h263p,h264
auth=turnip
aors=turnip
turnip
password=xxxxxxxx ; put a strong, unique password here instead
username=turnip
turnip

Still no video!!!

what is SDP offer? can you explain?

I have it working, I used allow=all under each peer in sip.conf

The body of the INVITE request.

Also, please mark up configurations, for the forum, as pre-formatted text. The friends_internal section appears not to be used, but this may be the result of the configuration being treated as forum mark up.

If it really isn’t referenced, that would explain why you are ending up in the default context.

Also, you should disable pjsip, if you are using sip (although chan_sip is effectively unsupported, so you should really be using pjsip).

So I can use sip OR pjsip? I do not need TWO? I get it now.

The extension requested (internal) context and I fixed that.

I wil try with just pjsip.conf next.

My next issue is how to get text messages and file transfer working, any suggestions?

have to delete post from bots

You are trying to initiate a voice call in response to an out of dialogue message!

You need to send an out of dialogue message!

damn bots damn bots damn bots

I am getting an error where the extensions.conf is invoked and cant find ADDR for extension #1

I think I need to direct the SMS at a sip:user but I cant find the exten=> to do it.

[Feb  8 00:15:27] ERROR[22715][C-00000001]: netsock2.c:303 ast_sockaddr_resolve: getaddrinfo("%231", "(null)", ...): Name or service not known
[Feb  8 00:15:27] WARNING[22715][C-00000001]: chan_sip.c:6394 create_addr: No such host: %231

So I have voice and audio working but not txt messages or file transfer

this is the message I am getting as an error

[Feb  8 00:15:27] ERROR[22715][C-00000001]: netsock2.c:303 ast_sockaddr_resolve: getaddrinfo("%231", "(null)", ...): Name or service not known
[Feb  8 00:15:27] WARNING[22715][C-00000001]: chan_sip.c:6394 create_addr: No such host: %231

this is my extensions.conf

[from-internal]
exten => #1,1,Dial(SIP/turnip)
exten= > #2,1,Dial(SIP/sorcerer)
exten => #1,1,Goto(sms,${EXTEN},1) ; SMS from SIP phone to Asterisk
exten => #2,1,Goto(sms,${EXTEN},1) ; SMS from SIP phone to Asterisk

[sms]
exten => _.,1,NoOp(SMS receiving dialplan invoked)
exten => _.,n,NoOp(To ${MESSAGE(to)})
exten => _.,n,NoOp(From ${MESSAGE(from)})
exten => _.,n,NoOp(Body ${MESSAGE(body)})
exten => _.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => _.,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
exten => _.,n,Hangup()
; 
; Handle failed messaging
exten => _.,n(sendfailedmsg),Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed.$
exten => _.,n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
exten => _.,n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
exten => _.,n,MessageSend(${ACTUALFROM},ServiceCenter)
exten => _.,n,Hangup()
exten => _.,n,Hangup()

I feel I need to direct the extension to a SIP:user and dont know how

I changed my extensions file to one i found online

and then it says cant load AGI, so I load res_agi it says cant load speech, so i load _res_speech

now its saying these errors
[Feb 8 00:57:15] WARNING[23425][C-00000001]: res_agi.c:2223 launch_script: Failed to execute ‘/var/lib/asterisk/agi-bin/chatplan.php’: File does not exist.
[Feb 8 00:57:50] WARNING[23425][C-00000001]: message.c:1221 msg_send_exec: A ‘to’ URI is required for MessageSend()

is my installation faulty?

Should i save my sip and extensions files and flush asterisk out and start again?

You haven’t included the verbose level logging of the Noop applications, so we can’t work out why it thinks the host name is a, single, top bit set, character. Is your host name non-ASCII?

(The only reason for including the parameters as arguments of Noop is to get them in the log.)

Also, this doesn’t really stand on its own. It needs to be linked to the previous threads.

After some changes to extension.conf I managed to get SUCCESS with sending a txt message from the server but it seems to be sending via No NAT to port 5060 when my port is 5062.

As someone previously mentioned I am using sip,conf and pjsip.conf at same time so this may be an issue.

I will try changing back to port 5060 and see if it changes and perhaps after I can post my sip.conf and pjsip.conf and you can give me some ideas on how to migrate to pjsip.conf?

Tried migrating the settings over manually to pjsip.conf and changes SIP/user to PJSIP/user in extensions but wont REGISTER.

Now I can register and call each phone but no audio or video or txt or file transfers, here is my pjsip.conf

[transport-udp]
type=transport
protocol=udp
bind=10.1.1.18:7777

[turnip]
type=endpoint
context=from-internal
disallow=all
allow=alaw
allow=ulaw
transport=transport-udp
auth=authturnip
aors=turnip

[turnip]
type=aor
max_contacts=1

[turnip]
type=identity
endpoint=turnip


[authturnip]
type=auth
auth_type=userpass
password=x
username=turnip

[pumpkin]
type=endpoint
context=from-internal
disallow=all
allow=alaw
allow=ulaw
transport=transport-udp
auth=authpumpkin
aors=pumpkin

[pumpkin]
type=aor
max_contacts=1

[pumpkin]
type=identity
endpoint=pumpkin

[authpumpkin]
type=auth
auth_type=userpass
password=x
username=pumpkin

update:
I now have video and audio working but no txt messages as my extensions.conf is wrong.

update:

now I can text one way! but not the other!

here is my extensions.conf

[from-internal]
exten => turnip,1,Dial(PJSIP/turnip)
exten => pumpkin,1,Dial(PJSIP/pumpkin)
; exten => #1,1,Goto(sms,${EXTEN},1) ; SMS from SIP phone to Asterisk
; exten => #2,1,Goto(sms,${EXTEN},1) ; SMS from SIP phone to Asterisk

[sms]
exten => _.,1,NoOp(SMS receiving dialplan invoked)
exten => _.,n,NoOp(To ${MESSAGE(to)})
exten => _.,n,NoOp(From ${MESSAGE(from)})
exten => _.,n,NoOp(Body ${MESSAGE(body)})
; exten => _.,n,AGI(chatplan.php,${MESSAGE(from)})
; exten => _.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
; exten => _.,n,Set(ACTUALTO=sorcerer@xxx)
exten => _.,n,MessageSend(${MESSAGE(to)},${MESSAGE(from)})
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
exten => _.,n,Hangup()
;
; Handle failed messaging
exten => _.,n(sendfailedmsg),NoOp(Sending error to user)
exten => _.,n,Set(SRC=${MESSAGE(from)})
exten => _.,n,Set(DST=${MESSAGE(to)})
exten => _.,n,Set(MSG=${MESSAGE(body)})
exten => _.,n,Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Sending when available")
exten => _.,n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
exten => _.,n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
exten => _.,n,MessageSend(${ACTUALFROM},ServiceCenter)
exten => _.,n,GotoIf($["${INQUEUE}" != "1"]?startq)
exten => _.,n,Hangup()

;
exten => _.,n(startq),NoOp(Queueing messaging for offline)
exten => _.,n,Set(MSGTIME=${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)})
; exten => _.,n,SYSTEM(/var/lib/asterisk/agi-bin/astqueue.sh –SRC ‘${SRC}’ –DST ‘${DST}’ –MSG ‘${MSG}’)
exten => _.,n,Hangup()[app-fakeanswer]
exten => _.,1,NoCDR
exten => _.,n,Set(DESTDEV=${EXTEN})
exten => _.,n,Set(THISDEVSTATE=${DEVICE_STATE(SIP/${DESTDEV})})
exten => _.,n,GotoIf($["${THISDEVSTATE}" = "UNAVAILABLE"]?hang)
exten => _.,n,GotoIf($["${THISDEVSTATE}" = "UNKNOWN"]?hang)
exten => _.,n,Answer
exten => _.,n,Hangup()
exten => _.,n(hang),Hangup()

[sms2]
exten => _.,1,NoOp(SMS receiving dialplan invoked)
exten => _.,n,NoOp(To ${MESSAGE(to)})
exten => _.,n,NoOp(From ${MESSAGE(from)})
exten => _.,n,NoOp(Body ${MESSAGE(body)})
; exten => _.,n,AGI(chatplan.php,${MESSAGE(from)})
; exten => _.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
; exten => _.,n,Set(ACTUALTO=sorcerer@xxx)
exten => _.,n,MessageSend(${MESSAGE(to)},${MESSAGE(from)})
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
exten => _.,n,Hangup()
;

;
exten => _.,n(startq),NoOp(Queueing messaging for offline)
exten => _.,n,Set(MSGTIME=${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)})
; exten => _.,n,SYSTEM(/var/lib/asterisk/agi-bin/astqueue.sh –SRC ‘${SRC}’ –DST ‘${DST}’ –MSG ‘${MSG}’)
exten => _.,n,Hangup()[app-fakeanswer]
exten => _.,1,NoCDR
exten => _.,n,Set(DESTDEV=${EXTEN})
exten => _.,n,Set(THISDEVSTATE=${DEVICE_STATE(SIP/${DESTDEV})})
exten => _.,n,GotoIf($["${THISDEVSTATE}" = "UNAVAILABLE"]?hang)
exten => _.,n,GotoIf($["${THISDEVSTATE}" = "UNKNOWN"]?hang)
exten => _.,n,Answer
exten => _.,n,Hangup()
exten => _.,n(hang),Hangup()

[sms2]
exten => _.,1,NoOp(SMS receiving dialplan invoked)
exten => _.,n,NoOp(To ${MESSAGE(to)})
exten => _.,n,NoOp(From ${MESSAGE(from)})
exten => _.,n,NoOp(Body ${MESSAGE(body)})
; exten => _.,n,AGI(chatplan.php,${MESSAGE(from)})
; exten => _.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
; exten => _.,n,Set(ACTUALTO=sorcerer@14.203.153.173)
exten => _.,n,MessageSend(${MESSAGE(to)},${MESSAGE(from)})
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
exten => _.,n,Hangup()
;

update:

I had to reinstall LINPHONE APP and now it works both ways with txt messages
now I hav to try file transfers

UPDATE: I realised file transfer is not support in Asterisk so I also remembered a few years ago I used a different application and it worked well, kamailio. So I am installining it and it can be used with Asterisk as well they say. i will post my full Asterisk configuration with a few notes on how I got my system running in case people are interested once I can post a new post. T

As stated here is my running config of PJSIP.conf and EXTENSIONS.conf for people who are struggling with setting this up.

You must load a few modules in MODULES.conf to get this to work including:

res_cut.so, res_alaw.so and res_h264.so .

My pjsip.conf

[transport-udp]
type=transport
protocol=udp
bind=10.2.2.20:5555

[turnip]
type=endpoint
context=from-internal
disallow=all
allow=alaw
allow=ulaw
allow=h264
transport=transport-udp
auth=authturnip
aors=turnip
message_context=sms
direct_media=yes

[turnip]
type=aor
max_contacts=1

[turnip]
type=identity
endpoint=turnip

[authturnip]
type=auth
auth_type=userpass
password=xxxxxxxx
username=turnip

[pumpkin]
type=endpoint
context=from-internal
disallow=all
allow=alaw
allow=ulaw
allow=h264
transport=transport-udp
auth=authpumpkin
aors=pumpkin
message_context=sms
direct_media=yes

[pumpkin]
type=aor
max_contacts=1

[pumpkin]
type=identity
endpoint=pumpkin

[authpumpkin]
type=auth
auth_type=userpass
password=xxxxxxxx
username=pumpkin

My extensions.conf (the part I added at bottom). I have left the bits I did not use too.

[from-internal]
exten => turnip,1,Dial(PJSIP/turnip)
exten => pumpkin,1,Dial(PJSIP/pumpkin)
; exten => #1,1,Goto(sms,${EXTEN},1) ; SMS from SIP phone to Asterisk
; exten => #2,1,Goto(sms,${EXTEN},1) ; SMS from SIP phone to Asterisk

[sms]
exten => _.,1,NoOp(SMS receiving dialplan invoked)
exten => _.,n,NoOp(To ${MESSAGE(to)})
exten => _.,n,NoOp(From ${MESSAGE(from)})
exten => _.,n,NoOp(Body ${MESSAGE(body)})
; exten => _.,n,AGI(chatplan.php,${MESSAGE(from)})
; exten => _.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
; exten => _.,n,Set(ACTUALTO=sorcerer@xxx.xxx.xxx.xxx)
exten => _.,n,MessageSend(${MESSAGE(to)},${MESSAGE(from)})
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
exten => _.,n,Hangup()
;
; Handle failed messaging
exten => _.,n(sendfailedmsg),NoOp(Sending error to user)
exten => _.,n,Set(SRC=${MESSAGE(from)})
exten => _.,n,Set(DST=${MESSAGE(to)})
exten => _.,n,Set(MSG=${MESSAGE(body)})
exten => _.,n,Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Sending when available")
exten => _.,n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
exten => _.,n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
exten => _.,n,MessageSend(${ACTUALFROM},ServiceCenter)
exten => _.,n,GotoIf($["${INQUEUE}" != "1"]?startq)
exten => _.,n,Hangup()
;
exten => _.,n(startq),NoOp(Queueing messaging for offline)
exten => _.,n,Set(MSGTIME=${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)})
; exten => _.,n,SYSTEM(/var/lib/asterisk/agi-bin/astqueue.sh –SRC ‘${SRC}’ –DST '${DST}’ –MSG ‘${MSG}’)
exten => _.,n,Hangup()[app-fakeanswer]
exten => _.,1,NoCDR
exten => _.,n,Set(DESTDEV=${EXTEN})
exten => _.,n,Set(THISDEVSTATE=${DEVICE_STATE(SIP/${DESTDEV})})
exten => _.,n,GotoIf($["${THISDEVSTATE}" = "UNAVAILABLE"]?hang)
exten => _.,n,GotoIf($["${THISDEVSTATE}" = "UNKNOWN"]?hang)
exten => _.,n,Answer
exten => _.,n,Hangup()
exten => _.,n(hang),Hangup()

max_contacts is set to 1, I had issues with registrations getting stuck so you might need to clear them in the CLI.

use database deltree registrar/contact to clear them.

With firewall configuration and PORT FORWARDING to a PUBLIC IP I managed to get TWO WAY voice, video and text messages.

Hope this helps someone.

https://www.youtube.com/watch?v=dVGINIsLnqU