How do you send a text on a SIP trunk?

Hi,

I’m already using the application MessageSend to send text to our internal sip phones and it is working.
I now need to send a SMS to a cellular via our sip trunk and I cannot get it to work.

I’m using the following:

exten => *55,1,NoOp()
same => n,Set(MESSAGE(body)=Hello)
same => n,MessageSend(pjsip:6048587458@mysiptrunk,Telephone)
same => n,Hangup()

mysiptrunk is an endpoint in my pjsip.conf file but all I get when I dial *55 is this:

Executing [*55@garneau-interne:1] NoOp(“PJSIP/01-A-A4934CFE2736-000114fb”, “”) in new stack
[Nov 4 13:21:52] – Executing [*55@garneau-interne:2] Set(“PJSIP/01-A-A4934CFE2736-000114fb”, “MESSAGE(body)=Hello”) in new stack
[Nov 4 13:21:52] – Executing [*55@garneau-interne:3] MessageSend(“PJSIP/01-A-A4934CFE2736-000114fb”, “pjsip:6048587458@mysiptrunk,Telephone”) in new stack
[Nov 4 13:21:52] – Executing [*55@garneau-interne:4] Hangup(“PJSIP/01-A-A4934CFE2736-000114fb”, “”) in new stack

ERROR[24884]: res_pjsip_messaging.c:615 msg_send: PJSIP MESSAGE - Could not find endpoint ‘sip:6048587458@mysiptrunk’ and no default outbound endpoint configured

you should probably ask your provider if supports SIP SIMPLE protocol.

We asked them and they said yes, but I’m not sure if Asterisk support this feature when the endpoint is external with PJSIP.

Here’s how the To field is interpreted by Asterisk’s res_pjsip_messaging:

	/* attempt to extract the endpoint name */
	if ((aor_uri = strchr(name, '/'))) {
		/* format was 'endpoint/(aor_name | uri)' */
		*aor_uri++ = '\0';
	} else if ((aor_uri = strchr(name, '@'))) {
		/* format was 'endpoint@domain' - discard the domain */
		*aor_uri = '\0';

		/*
		 * We may want to match without any user options getting
		 * in the way.
		 */
		AST_SIP_USER_OPTIONS_TRUNCATE_CHECK(name);
	}

That is, the To field needs to be one of:

  • {endpoint}
  • {endpoint}/{sip URI}
  • {endpoint}/{aor}
  • {endpoint}@domain (where we’re just going to ignore the domain part for these purposes, and use the AoR contacts for sending the request)

Since you’re trying to send it to an explicit number on a trunk, you may want to send it to a SIP URI via your trunk endpoint. That would be:

pjsip:mysiptrunk/sip:6048587458@mysiptrunk.com

1 Like

Thanks a lot. The message is now going out but our provider misled us because when doing a wireshark capture I get a Not impemented response.