Pjsip message issue

Hello,

I’m trying MessageSend aplication with PJSIP Endpoints. If the endpoints are online all works correctly. If a endpoint is offline and I send it a MESSAGE:

Executing [1003@message-pjsip:1] NoOp(“Message/ast_msg_queue”, “Mensaje de “1000” sip:1000@45.56.72.250”) in new stack
Executing [1003@message-pjsip:2] NoOp(“Message/ast_msg_queue”, “Mensaje para pjsip:1003@45.56.72.250”) in new stack
Executing [1003@message-pjsip:3] NoOp(“Message/ast_msg_queue”, “Texto = hola3”) in new stack
Executing [1003@message-pjsip:4] MessageSend(“Message/ast_msg_queue”, “pjsip:1003,“1000” sip:1000@45.56.72.250”) in new stack
Executing [1003@message-pjsip:5] NoOp(“Message/ast_msg_queue”, “Estado del mensaje SUCCESS”) in new stack
Executing [1003@message-pjsip:6] Hangup(“Message/ast_msg_queue”, “”) in new stack
== Spawn extension (message-pjsip, 1003, 6) exited non-zero on ‘Message/ast_msg_queue’
[Oct 21 17:09:53] ERROR[19784]: res_pjsip.c:3159 create_out_of_dialog_request: Unable to retrieve contact for endpoint 1003
[Oct 21 17:09:53] ERROR[19784]: res_pjsip_messaging.c:622 msg_send: PJSIP MESSAGE - Could not create request

My PJSIP dialplan:

exten => _X.,1,Noop(Mensaje de ${MESSAGE(from)})
same => n,Noop(Mensaje para ${MESSAGE(to)})
same => n,Noop(Texto = ${MESSAGE(body)})
same => n,Messagesend(pjsip:${EXTEN},${MESSAGE(from)})
same => n,Noop(Estado del mensaje ${MESSAGE_SEND_STATUS})
same => n,Hangup

The ${MESSAGE_SEND_STATUS} variable always contain SUCCESS.

If I use chan_sip:

Executing [1002@message:1] NoOp(“Message/ast_msg_queue”, “Mensaje de “1000” sip:1000@45.56.72.250”) in new stack
– Executing [1002@message:2] NoOp(“Message/ast_msg_queue”, “Mensaje para sip:1002@45.56.72.250”) in new stack
– Executing [1002@message:3] NoOp(“Message/ast_msg_queue”, “Texto = Hola3”) in new stack
– Executing [1002@message:4] MessageSend(“Message/ast_msg_queue”, “sip:1002,“1000” sip:1000@45.56.72.250”) in new stack
– Executing [1002@message:5] NoOp(“Message/ast_msg_queue”, “Estado del mensaje FAILURE”) in new stack
– Executing [1002@message:6] Hangup(“Message/ast_msg_queue”, “”) in new stack
== Spawn extension (message, 1002, 6) exited non-zero on ‘Message/ast_msg_queue’

The ${MESSAGE_SEND_STATUS} variable always contain FAILURE (Correct)

My SIP dialplan:

exten => _X.,1,Noop(Mensaje de ${MESSAGE(from)})
same => n,Noop(Mensaje para ${MESSAGE(to)})
same => n,Noop(Texto = ${MESSAGE(body)})
same => n,Messagesend(sip:${EXTEN},${MESSAGE(from)})
same => n,Noop(Estado del mensaje ${MESSAGE_SEND_STATUS})
same => n,Hangup

Any hint?

Regards

The definition of SUCCESS is “Successfully passed on to the protocol handler, but delivery has not necessarily been guaranteed”. In the case of PJSIP, the check for an existing contact is done in another thread and can’t be reported here. You could use the EXTENSION_STATE, DEVICE_STATE or PJSIP_DIAL_CONTACTS functions to figure out if the endpoint is registered.

Thank you very much.

Regards