Pjsip messaging: nothing works

Why pjsip messaging give me errors? I send one message from softphone (Microsip) to hardphone (GrandStream 2170).
The message go in the unknown


[Feb 21 15:29:49]     -- Executing [1000@local:1] NoOp("Message/ast_msg_queue", "") in new stack
[Feb 21 15:29:49]     -- Executing [1000@local:2] Dial("Message/ast_msg_queue", "PJSIP/telefono1,20,TtkK") in new stack
[Feb 21 15:29:49]     -- Called PJSIP/telefono1
[Feb 21 15:29:49] ERROR[8967][C-00000001]: translate.c:1402 ast_translator_best_choice: Cannot determine best translation path since one capability supports no formats
[Feb 21 15:29:49] WARNING[8967][C-00000001]: channel.c:6756 ast_channel_make_compatible_helper: No path to translate from PJSIP/telefono1-00000007 to Message/ast_msg_queue
[Feb 21 15:29:49]   == Spawn extension (local, 1000, 2) exited non-zero on 'Message/ast_msg_queue'
asterisk1*CLI> 



This is the pjsip.conf

[transport-tls]
type=transport
protocol=tls
bind=0.0.0.0
cert_file=/etc/ssl/certs/asterisk1.blu.priv.crt
priv_key_file= /etc/ssl/private/asterisk1.blu.priv.key
ca_list_file= /etc/ssl/certs/blu.priv.crt
method=tlsv1_2

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

[telefono1]
type=aor
max_contacts=10

[telefono1]
type=auth
auth_type=userpass
username=telefono1
password=*****************; replace

[telefono1]
type=endpoint
context=local
allow=!all,alaw,ulaw,g729,g723,ilbc
direct_media=yes
callerid="*******" <************> ;replace with yourid
media_encryption=sdes
inband_progress=yes
tone_zone=it
language=it
auth=telefono1
aors=telefono1

[reg_192.168.0.1]
type=registration
retry_interval=20
max_retries=10
expiration=120
transport=transport-udp
outbound_auth=auth_reg_192.168.0.1
client_uri=sip:asterisk01@192.168.0.1
server_uri=sip:192.168.0.1

[auth_reg_192.168.0.1]
type=auth
password=************************ ; replace with the pass for phone on FritzBox
username=asterisk01

[asterisk01]
type=aor
contact=sip:asterisk01@192.168.0.1

[asterisk01]
type=identify
endpoint=asterisk01
match=192.168.0.1

[asterisk01]
type=auth
username=asterisk01
password=*************************; replace with the pass for phone on FritzBox

[asterisk01]
type=endpoint
context=uscita
allow=!all,alaw,ulaw,g729,g723,ilbc
direct_media=no
rtp_keepalive=1
inband_progress=yes
from_user=asterisk01
from_domain=192.168.0.1
tone_zone=it
language=it
auth=asterisk01
outbound_auth=asterisk01
aors=asterisk01

This is the extensions.conf

[globals]
TELEFONOSIP1=PJSIP/telefono1 ;1000
TELEFONOSIP2=PJSIP/telefono2 ;1001
TELEFONOANALOGICO1=DAHDI/17 ;4005
TELEFONOANALOGICO2=DAHDI/18 ;4006
TELEFONOANALOGICO3=DAHDI/19 ;4007
PHONEEXTNUMBER=*******************

[local]
include => uscita
include => from-dahdi

exten => 1000,1,NoOp()
same => n,Dial(PJSIP/telefono1,20,TtkK)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)   
same => n(unavail),VoiceMail(1000@interni,u)                
same => n,Hangup()                                         
same => n(busy),VoiceMail(1000@interni,b)                 
same => n,Hangup()

exten => 1001,1,NoOp()
same => n,Dial(PJSIP/telefono2,20,TtkK)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)   
same => n(unavail),VoiceMail(1001@interni,u)                
same => n,Hangup()                                         
same => n(busy),VoiceMail(1001@interni,b)                 
same => n,Hangup()

; Segreteria telefonica
exten => 7500,1,VoicemailMain(@interni)

; Test dell'eco
exten => 600,1,NoOp()
same => n(open),Answer()
same => n,Playback(demo-echotest) ; Let them know what
same => n,Echo()                  ; Do the echo test
same => n,Playback(demo-echodone) ; Let them know it
same => n(close),Playback(go-away2) ; Let them know it
same => n,Hangup()

; chiama il 511 per ascoltare la musica
exten => 511,1,Answer
exten => 511,n(musica),MusicOnHold()

; chiama il 200 per sentire ciao mondo
exten => 200,1,Answer()
same => n,Playback(hello-world)
same => n,Hangup()

; Tim uscita
[uscita]
exten => _XXXXX.,1,NoOp()
same => n,Dial(PJSIP/${EXTEN}@asterisk01,30,tTkK)
same => n,Hangup()

exten = s,1,NoOp()
same => n,Set(CDR(original_dst)=${PHONEEXTNUMBER})
same => n,Dial(PJSIP/telefono1&DAHDI/17,30,tTkK)
same => n,Hangup()

[from-dahdi]
include => uscita
include => local

exten => 4005,1,NoOp()
same => n,Dial(DAHDI/17,20,TtkK)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)   
same => n(unavail),VoiceMail(4005@interni,u)                
same => n,Hangup()                                         
same => n(busy),VoiceMail(4005@interni,b)                 
same => n,Hangup()

exten => s,1,Answer()
exten => s,n,Dial(Local/${EXTEN},20,tTkK)
exten => s,n,Hangup()

Any suggestion? Thanks

You don’t seem to have any dialplan or configuration written to allow text messaging between devices. It is not built in, and requires explicit logic to be done by you. I don’t have any handy, but it would involve the use of the MessageSend dialplan application[1] and the message_context endpoint option[2].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Application_MessageSend
[2] Asterisk 20 Configuration_res_pjsip - Asterisk Project - Asterisk Project Wiki

1 Like

Thanks, I have also tried some configurations
First is this one

[sms]
exten => _XXXX,1,NoOp(SMS receiving dialplan invoked)
same => n,NoOp(To ${MESSAGE(to)})
same => n,NoOp(From ${MESSAGE(from)})
same => n,NoOp(Body ${MESSAGE(body)})
same => n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
same => n,ExecIf($["${ACTUALTO}" = "sip:1000"]?set(ACTUALTO2=telefono1))
same => n,ExecIf($["${ACTUALTO}" = "sip:1001"]?set(ACTUALTO2=telefono2))
same => n,MessageSend(sip:${ACTUALTO2},"${CALLERID(name)}"${MESSAGE(from)})
same => n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
same => n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
same => n,Hangup()
same => n(sendfailedmsg),Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.")
same => n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
same => n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
same => n,MessageSend(${ACTUALFROM},ServiceCenter)
same => n,Hangup()

exten => telefono2,1,NoOp(SMS receiving dialplan invoked)
same => n,NoOp(To ${MESSAGE(to)})
same => n,NoOp(From ${MESSAGE(from)})
same => n,NoOp(Body ${MESSAGE(body)})
same => n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
same => n,ExecIf($["${ACTUALTO}" = "sip:telefono1"]?set(ACTUALTO2=telefono1))
same => n,ExecIf($["${ACTUALTO}" = "sip:telefono2"]?set(ACTUALTO2=telefono2))
same => n,MessageSend(sip:${ACTUALTO2},"${CALLERID(name)}"${MESSAGE(from)})
same => n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
same => n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
same => n,Hangup()
same => n(sendfailedmsg),Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.")
same => n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
same => n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
same => n,MessageSend(${ACTUALFROM},ServiceCenter)
same => n,Hangup()

exten => telefono1,1,NoOp(SMS receiving dialplan invoked)
same => n,NoOp(To ${MESSAGE(to)})
same => n,NoOp(From ${MESSAGE(from)})
same => n,NoOp(Body ${MESSAGE(body)})
same => n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
same => n,ExecIf($["${ACTUALTO}" = "sip:telefono1"]?set(ACTUALTO2=telefono1))
same => n,ExecIf($["${ACTUALTO}" = "sip:telefono2"]?set(ACTUALTO2=telefono2))
same => n,MessageSend(sip:${ACTUALTO2},"${CALLERID(name)}"${MESSAGE(from)})
same => n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
same => n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
same => n,Hangup()
same => n(sendfailedmsg),Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.")
same => n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
same => n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
same => n,MessageSend(${ACTUALFROM},ServiceCenter)
same => n,Hangup()

And voilà…nothing change :slight_smile:


[Feb 21 15:35:28]   == Setting global variable 'TELEFONOSIP1' to 'PJSIP/telefono1'
[Feb 21 15:35:28]   == Setting global variable 'TELEFONOSIP2' to 'PJSIP/telefono2'
[Feb 21 15:35:28]   == Setting global variable 'TELEFONOANALOGICO1' to 'DAHDI/17'
[Feb 21 15:35:28]   == Setting global variable 'TELEFONOANALOGICO2' to 'DAHDI/18'
[Feb 21 15:35:28]   == Setting global variable 'TELEFONOANALOGICO3' to 'DAHDI/19'
[Feb 21 15:35:28]   == Setting global variable 'PHONEEXTNUMBER' to '*******************'
[Feb 21 15:35:28]     -- Time to scan old dialplan and merge leftovers back into the new: 0.000129 sec
[Feb 21 15:35:28]     -- Time to restore hints and swap in new dialplan: 0.000009 sec
[Feb 21 15:35:28]     -- Time to delete the old dialplan: 0.000041 sec
[Feb 21 15:35:28]     -- Total time merge_contexts_delete: 0.000179 sec
[Feb 21 15:35:28]     -- pbx_config successfully loaded 4 contexts (enable debug for details).
[Feb 21 15:35:42]     -- Executing [1000@local:1] NoOp("Message/ast_msg_queue", "") in new stack
[Feb 21 15:35:42]     -- Executing [1000@local:2] Dial("Message/ast_msg_queue", "PJSIP/telefono1,20,TtkK") in new stack
[Feb 21 15:35:42]     -- Called PJSIP/telefono1
[Feb 21 15:35:42] ERROR[8967][C-00000001]: translate.c:1402 ast_translator_best_choice: Cannot determine best translation path since one capability supports no formats
[Feb 21 15:35:42] WARNING[8967][C-00000001]: channel.c:6756 ast_channel_make_compatible_helper: No path to translate from PJSIP/telefono1-0000000a to Message/ast_msg_queue
[Feb 21 15:35:42]   == Spawn extension (local, 1000, 2) exited non-zero on 'Message/ast_msg_queue'

Did you set message_context to the messaging context on the respective endpoint and reload PJSIP? If not, then it won’t go to the dialplan context that has the provided logic.

1 Like

Solution found! thanks to user jcolp for help me
Was more easy than sip.conf

A)Edit pjsip.conf and for every endpoint configured add

message_context=sms ;the contest must be the SAME in extensions.conf

b)on extensions.conf, i use my classical sms context but with some mods, instead of sip I use pjsip

If someone need in the future

extensions.conf example with sms

[globals]
TELEFONOSIP1=PJSIP/telefono1 ;1000
TELEFONOSIP2=PJSIP/telefono2 ;1001
TELEFONOANALOGICO1=DAHDI/17 ;4005
TELEFONOANALOGICO2=DAHDI/18 ;4006
TELEFONOANALOGICO3=DAHDI/19 ;4007
PHONEEXTNUMBER=*******************

[local]
include => sms
include => uscita
include => from-dahdi

exten => 1000,1,NoOp()
same => n,Dial(PJSIP/telefono1,20,TtkK)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)   
same => n(unavail),VoiceMail(1000@interni,u)                
same => n,Hangup()                                         
same => n(busy),VoiceMail(1000@interni,b)                 
same => n,Hangup()

exten => 1001,1,NoOp()
same => n,Dial(PJSIP/telefono2,20,TtkK)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)   
same => n(unavail),VoiceMail(1001@interni,u)                
same => n,Hangup()                                         
same => n(busy),VoiceMail(1001@interni,b)                 
same => n,Hangup()

; Segreteria telefonica
exten => 7500,1,VoicemailMain(@interni)

; Test dell'eco
exten => 600,1,NoOp()
same => n(open),Answer()
same => n,Playback(demo-echotest) ; Let them know what
same => n,Echo()                  ; Do the echo test
same => n,Playback(demo-echodone) ; Let them know it
same => n(close),Playback(go-away2) ; Let them know it
same => n,Hangup()

; chiama il 511 per ascoltare la musica
exten => 511,1,Answer
exten => 511,n(musica),MusicOnHold()

; chiama il 200 per sentire ciao mondo
exten => 200,1,Answer()
same => n,Playback(hello-world)
same => n,Hangup()

; Tim uscita
[uscita]
exten => _XXXXX.,1,NoOp()
same => n,Dial(PJSIP/${EXTEN}@asterisk01,30,tTkK)
same => n,Hangup()

exten = s,1,NoOp()
same => n,Set(CDR(original_dst)=${PHONEEXTNUMBER})
same => n,Dial(PJSIP/telefono1&DAHDI/17,30,tTkK)
same => n,Hangup()

[from-dahdi]
include => TestMenu
include => uscita
include => local

exten => 4005,1,NoOp()
same => n,Dial(DAHDI/17,20,TtkK)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)   
same => n(unavail),VoiceMail(4005@interni,u)                
same => n,Hangup()                                         
same => n(busy),VoiceMail(4005@interni,b)                 
same => n,Hangup()

exten => s,1,Answer()
exten => s,n,Dial(Local/${EXTEN},20,tTkK)
exten => s,n,Hangup()

[sms]
exten => _XXXX,1,NoOp(SMS receiving dialplan invoked)
same => n,NoOp(To ${MESSAGE(to)})
same => n,NoOp(From ${MESSAGE(from)})
same => n,NoOp(Body ${MESSAGE(body)})
same => n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
same => n,ExecIf($["${ACTUALTO}" = "pjsip:1000"]?set(ACTUALTO2=telefono1))
same => n,ExecIf($["${ACTUALTO}" = "pjsip:1001"]?set(ACTUALTO2=telefono2))
same => n,MessageSend(pjsip:${ACTUALTO2},"${CALLERID(name)}"${MESSAGE(from)})
same => n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
same => n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
same => n,Hangup()
same => n(sendfailedmsg),Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.")
same => n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
same => n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
same => n,MessageSend(${ACTUALFROM},ServiceCenter)
same => n,Hangup()

exten => telefono2,1,NoOp(SMS receiving dialplan invoked)
same => n,NoOp(To ${MESSAGE(to)})
same => n,NoOp(From ${MESSAGE(from)})
same => n,NoOp(Body ${MESSAGE(body)})
same => n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
same => n,ExecIf($["${ACTUALTO}" = "pjsip:telefono1"]?set(ACTUALTO2=telefono1))
same => n,ExecIf($["${ACTUALTO}" = "pjsip:telefono2"]?set(ACTUALTO2=telefono2))
same => n,MessageSend(pjsip:${ACTUALTO2},"${CALLERID(name)}"${MESSAGE(from)})
same => n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
same => n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
same => n,Hangup()
same => n(sendfailedmsg),Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.")
same => n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
same => n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
same => n,MessageSend(${ACTUALFROM},ServiceCenter)
same => n,Hangup()

exten => telefono1,1,NoOp(SMS receiving dialplan invoked)
same => n,NoOp(To ${MESSAGE(to)})
same => n,NoOp(From ${MESSAGE(from)})
same => n,NoOp(Body ${MESSAGE(body)})
same => n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
same => n,ExecIf($["${ACTUALTO}" = "pjsip:telefono1"]?set(ACTUALTO2=telefono1))
same => n,ExecIf($["${ACTUALTO}" = "pjsip:telefono2"]?set(ACTUALTO2=telefono2))
same => n,MessageSend(pjsip:${ACTUALTO2},"${CALLERID(name)}"${MESSAGE(from)})
same => n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
same => n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
same => n,Hangup()
same => n(sendfailedmsg),Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.")
same => n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
same => n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
same => n,MessageSend(${ACTUALFROM},ServiceCenter)
same => n,Hangup()

and pjsip.conf with sms context

[transport-tls]
type=transport
protocol=tls
bind=0.0.0.0
cert_file=/etc/ssl/certs/asterisk1.blu.priv.crt
priv_key_file= /etc/ssl/private/asterisk1.blu.priv.key
ca_list_file= /etc/ssl/certs/blu.priv.crt
method=tlsv1_2

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

[telefono1]
type=aor
max_contacts=10

[telefono1]
type=auth
auth_type=userpass
username=telefono1
password=*****************; replace

[telefono1]
type=endpoint
context=local
message_context=sms
allow=!all,alaw,ulaw,g729,g723,ilbc
direct_media=yes
callerid="*******" <************> ;replace with yourid
media_encryption=sdes
inband_progress=yes
tone_zone=it
language=it
auth=telefono1
aors=telefono1

[reg_192.168.0.1]
type=registration
retry_interval=20
max_retries=10
expiration=120
transport=transport-udp
outbound_auth=auth_reg_192.168.0.1
client_uri=sip:asterisk01@192.168.0.1
server_uri=sip:192.168.0.1

[auth_reg_192.168.0.1]
type=auth
password=************************ ; replace with the pass for phone on FritzBox
username=asterisk01

[asterisk01]
type=aor
contact=sip:asterisk01@192.168.0.1

[asterisk01]
type=identify
endpoint=asterisk01
match=192.168.0.1

[asterisk01]
type=auth
username=asterisk01
password=*************************; replace with the pass for phone on FritzBox

[asterisk01]
type=endpoint
context=uscita
allow=!all,alaw,ulaw,g729,g723,ilbc
direct_media=no
rtp_keepalive=1
inband_progress=yes
from_user=asterisk01
from_domain=192.168.0.1
tone_zone=it
language=it
auth=asterisk01
outbound_auth=asterisk01
aors=asterisk01

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