Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not recieve message sent in chat #572

Open
arezvani opened this issue Dec 2, 2024 · 2 comments
Open

Not recieve message sent in chat #572

arezvani opened this issue Dec 2, 2024 · 2 comments

Comments

@arezvani
Copy link

arezvani commented Dec 2, 2024

I have this pjsip.conf:

[system]
type=system
timer_t1=500
timer_b=32000
disable_tcp_switch=yes

[global]
type=global
max_initial_qualify_time=0
keep_alive_interval=90
contact_expiration_check_interval=30
default_voicemail_extension=*97
unidentified_request_count=3
unidentified_request_period=5
unidentified_request_prune_interval=30
mwi_tps_queue_high=500
mwi_tps_queue_low=-1
mwi_disable_initial_unsolicited=yes
send_contact_status_on_update_registration=yes
message_context=textmessages

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

[6001]
type=endpoint
context=from-internal
disallow=all
allow=ulaw
auth=6001
aors=6001

[6001]
type=auth
auth_type=userpass
password=unsecurepassword
username=6001

[6001]
type=aor
max_contacts=2


[6002]
type=endpoint
context=from-internal
disallow=all
allow=ulaw
auth=6002
aors=6002

[6002]
type=auth
auth_type=userpass
password=123456
username=6002

[6002]
type=aor
max_contacts=2

[transport-wss]
type=transport
protocol=wss
bind=0.0.0.0
local_net=10.10.0.9/16
local_net=10.116.0.6/20
external_media_address=185.60.136.36
external_signaling_address=186.60.136.36
allow_reload=yes

[webrtc_client]
type=aor
max_contacts=5
remove_existing=yes

[webrtc_client]
type=auth
auth_type=userpass
username=webrtc_client
password=webrtc_client ; This is a completely insecure password! Do NOT expose this
 ; system to the Internet without utilizing a better password.

[webrtc_client]
type=endpoint
aors=webrtc_client
auth=webrtc_client
dtls_auto_generate_cert=yes
webrtc=yes
context=default
disallow=all
; We need to allow more codecs.
; vp8, vp9 and h264 are video pass-through codecs.
; No special Asterisk modules are required to support them.
allow=opus,g722,ulaw,vp9,vp8,h264
; Since video conferencing makes use of the Streams functionality added in Asterisk 15
; we need to indicate the maximum number of streams allowed for audio and video.
max_audio_streams = 1
max_video_streams = 15


[webrtc-phones](!)
context=main-context
transport=transport-wss
allow=!all,opus,ulaw,alaw,vp8,vp9
webrtc=yes

[User1](webrtc-phones)
type=endpoint
callerid=”User One” <100>
auth=User1
aors=User1

[User1]
type=aor
max_contacts=3

[User1]
type=auth
auth_type=userpass
username=User1
password=1234

[User2](webrtc-phones)
type=endpoint
callerid=”User Two” <101>
auth=User2
aors=User2

[User2]
type=aor
max_contacts=3

[User2]
type=auth
auth_type=userpass
username=User2
password=1234

[User3](webrtc-phones)
type=endpoint
callerid=”User Three” <102>
auth=User3
aors=User3

[User3]
type=aor
max_contacts=3

[User3]
type=auth
auth_type=userpass
username=User3
password=1234

also have this extensions.conf

[default]
exten = video-conference,1,Confbridge(MYCONF,default_bridge,default_user,sample_user_menu)

[general]
static=yes
writeprotect=yes
priorityjumping=no
autofallthrough=no

[globals]
ATTENDED_TRANSFER_COMPLETE_SOUND=beep

[main-context]
include => from-extensions
include => subscriptions
include => textmessages
include => echo-test
include => speak-exte-nnum

[echo-test]
exten => 777,1,NoOp(FEATURE: ECHO TEST)
 same => n,Answer
 same => n,Wait(1)
 same => n,Playback(demo-echotest)
 same => n,Echo()
 same => n,Playback(demo-echodone)
 same => n,Hangup()
;END of [echo-test]

[speak-exte-nnum]
exten => 888,1,NoOp(FEATURE: SPEAK MY EXTENSION NUMBER)
 same => n,Answer
 same => n,Wait(1)
 same => n,Playback(extension)
 same => n,Wait(1)
 same => n,SayDigits(${CALLERID(num)})
 same => n,Wait(2)
 same => n,Hangup()
;END of [speak-exte-nnum]

[textmessages]
exten => 100,1,Gosub(send-text,s,1,(User1))
exten => 101,1,Gosub(send-text,s,1,(User2))
exten => 102,1,Gosub(send-text,s,1,(User3))

[subscriptions]
exten => 100,hint,PJSIP/User1
exten => 101,hint,PJSIP/User2
exten => 102,hint,PJSIP/User3

[from-extensions]
; Feature Codes:
exten => *65,1,Gosub(moh,s,1)
; Extensions
exten => 100,1,Gosub(dial-extension,s,1,(User1))
exten => 101,1,Gosub(dial-extension,s,1,(User2))
exten => 102,1,Gosub(dial-extension,s,1,(User3))

exten => e,1,Hangup()

[moh]
exten => s,1,NoOp(Music On Hold)
exten => s,n,Ringing()
exten => s,n,Wait(2)
exten => s,n,Answer()
exten => s,n,Wait(1)
exten => s,n,MusicOnHold()

[dial-extension]
exten => s,1,NoOp(Calling: ${ARG1})
exten => s,n,Set(JITTERBUFFER(adaptive)=default)
exten => s,n,Dial(PJSIP/${ARG1},30)
exten => s,n,Hangup()

exten => e,1,Hangup()

[send-text]
exten => s,1,NoOp(Sending Text To: ${ARG1})
exten => s,n,Set(PEER=${CUT(CUT(CUT(MESSAGE(from),@,1),<,2),:,2)})
exten => s,n,Set(FROM=${SHELL(asterisk -rx ‘pjsip show endpoint ${PEER}’ | grep ‘callerid ‘ | cut -d’:’ -f2- | sed ‘s/^ *//’ | tr -d ‘‘)})
exten => s,n,Set(CALLERID_NUM=${CUT(CUT(FROM,>,1),<,2)})
exten => s,n,Set(FROM_SIP=${STRREPLACE(MESSAGE(from),
exten => s,n,MessageSend(pjsip:${ARG1},${FROM_SIP})
exten => s,n,Hangup()

When I send a message in chat other user don't recieve that and get this error:

    -- Executing [101@main-context:1] Gosub("Message/ast_msg_queue", "dial-extension,s,1,(User2)") in new stack
    -- Executing [s@dial-extension:1] NoOp("Message/ast_msg_queue", "Calling: User2") in new stack
    -- Executing [s@dial-extension:2] Set("Message/ast_msg_queue", "JITTERBUFFER(adaptive)=default") in new stack
    -- Executing [s@dial-extension:3] Dial("Message/ast_msg_queue", "PJSIP/User2,30") in new stack
    -- Called PJSIP/User2
[Dec  2 22:07:22] ERROR[759998][C-00000001]: translate.c:1419 ast_translator_best_choice: Cannot determine best translation path since one capability supports no formats
[Dec  2 22:07:22] WARNING[759998][C-00000001]: channel.c:6697 ast_channel_make_compatible_helper: No path to translate from PJSIP/User2-00000000 to Message/ast_msg_queue
  == Spawn extension (dial-extension, s, 3) exited non-zero on 'Message/ast_msg_queue'

what should I do?

@InnovateAsterisk
Copy link
Owner

Based on the log you provide, somehow its dialing the message context

-- Executing [s@dial-extension:3] Dial("Message/ast_msg_queue", "PJSIP/User2,30") in new stack

Looks like main-context includes message context, so call are able to follow it. But the message context only needs to be applied to the extension config.

This may work

[webrtc-phones](!)
context=main-context
message_context=textmessages
transport=transport-wss
allow=!all,opus,ulaw,alaw,vp8,vp9
webrtc=yes

But then take textmessages out of the includes for main-context.

@arezvani
Copy link
Author

arezvani commented Dec 3, 2024

Thank you. With this change error has been changed.
First I change extentions.conf to:

[send-text]
exten => s,1,NoOp(Sending Text To: ${ARG1})
exten => s,n,Set(PEER=${CUT(CUT(CUT(MESSAGE(from),@,1),<,2),:,2)})
exten => s,n,Set(FROM=${SHELL(asterisk -rx 'pjsip show endpoint ${PEER}' | grep 'callerid ' | cut -d':' -f2- | sed 's/^\ *//' | tr -d '\n')})
exten => s,n,Set(CALLERID_NUM=${CUT(CUT(FROM,>,1),<,2)})
exten => s,n,Set(FROM_SIP=${STRREPLACE(MESSAGE(from),<sip:${PEER}@,<sip:${CALLERID_NUM}@)})
exten => s,n,MessageSend(pjsip:${ARG1},${FROM_SIP})
exten => s,n,Hangup()

Now I get this error:

    -- Executing [100@textmessages:1] Gosub("Message/ast_msg_queue", "send-text,s,1,(User1)") in new stack
    -- Executing [s@send-text:1] NoOp("Message/ast_msg_queue", "Sending Text To: User1") in new stack
    -- Executing [s@send-text:2] Set("Message/ast_msg_queue", "PEER=User2") in new stack
    -- Remote UNIX connection
    -- Remote UNIX connection disconnected
    -- Executing [s@send-text:3] Set("Message/ast_msg_queue", "FROM="”User Two”" <101>") in new stack
    -- Executing [s@send-text:4] Set("Message/ast_msg_queue", "CALLERID_NUM=101") in new stack
    -- Executing [s@send-text:5] Set("Message/ast_msg_queue", "FROM_SIP="User2" <sip:101@*.*.*.*>") in new stack
    -- Executing [s@send-text:6] MessageSend("Message/ast_msg_queue", "pjsip:User1,"User2" <sip:101@*.*.*.*>") in new stack
[Dec  5 10:36:41] WARNING[1528633]: res_pjsip.c:3338 ast_sip_update_to_uri: To address '100@*.*.*.*' is not a valid SIP/SIPS URI
    -- Executing [s@send-text:7] Hangup("Message/ast_msg_queue", "") in new stack
  == Spawn extension (send-text, s, 7) exited non-zero on 'Message/ast_msg_queue'

Can you help me to solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants