Unable to send message

Hi,
I try to send message between two sip softphones. This configuration bellow does not works,
Could someone check my configs and point me to right direction?

sip.conf
[general]
context=public
allowoverlap=no
tcpenable=no
tcpbindaddr=0.0.0.0
transport=udp
srvlookup=yes
bindport=5060
videosupport=yes
accept_outofcall_message=yes
outofcall_message_contex=inomsg
auth_message_request=no

[inosmart]
type=friend
context=phones
secret=12345678
qualify=yes
host=dynamic
disallow=all
allow=ulaw,alaw,vp8

[android]
type=friend
context=phones
secret=12345678
qualify=yes
host=dynamic
disallow=all
allow=ulaw,alaw,vp8

extensions.conf
[phones]
exten => android,1,NoOp(Klicem android)
same => n,Dial(SIP/android)
same => n,HangUp

exten => inosmart,1,NoOp(Klicem inosmart))
same => n,Dial(SIP/inosmart)
same => n,HangUp

[inomsg]
exten => _XXX,1,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => _XXX,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => _XXX,n,Hangup

What is the asterisk console showing when you send a message? Is the inomsg context found and the call processing triggered? Try adding the console output when you send the message

Hi,
debug output:
<— Transmitting (no NAT) to 192.168.2.111:5071 —>
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 192.168.2.111:5071;branch=z9hG4bK.juf66eDRG;received=192.168.2.111;rport=5071
From: sip:inosmart@192.168.2.111;tag=fEulEOOEl
To: sip:android@192.168.2.111;tag=as70a986e0
Call-ID: mzTcNawocj
CSeq: 21 MESSAGE
Server: Asterisk PBX 13.15.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------>
– Executing [android@phones:1] NoOp(“Message/ast_msg_queue”, “Calling android”) in new stack
– Executing [android@phones:2] Dial(“Message/ast_msg_queue”, “SIP/android”) in new stack
Scheduling destruction of SIP dialog ‘mzTcNawocj’ in 6400 ms (Method: MESSAGE)
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [android@phones:3] Hangup(“Message/ast_msg_queue”, “”) in new stack
== Spawn extension (phones, android, 3) exited non-zero on ‘Message/ast_msg_queue’

<— SIP read from UDP:192.168.2.143:5062 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.94:5060;branch=z9hG4bK015712a3;rport=5060
Contact: sip:android@192.168.2.143:5062;+sip.instance="urn:uuid:CC7B38C1-0F0F-D04F-AB3A-343BC01AF8AC"
To: "android"sip:android@192.168.2.111;tag=f694b840
From: sip:inosmart@192.168.2.111;tag=as4120b037
Call-ID: TMvt7xa8oh3tc8MF6vvoZA…
CSeq: 102 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, REGISTER, SUBSCRIBE, INFO, PUBLISH
Content-Type: application/sdp
Supported: replaces, outbound, path
User-Agent: PortSIP SDK for Android
Allow-Events: hold, talk, conference
Content-Length: 292

v=0
o=- 1512937007 2 IN IP4 192.168.2.143
s=portsip.com
c=IN IP4 192.168.2.143
t=0 0
m=audio 20002 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv
m=video 43002 RTP/AVP 120
a=rtpmap:120 VP8/90000
a=sendrecv
<------------->
— (13 headers 14 lines) —
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 101
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found audio description format telephone-event for ID 101
Found RTP video format 120
Found video description format VP8 for ID 120
Capabilities: us - (ulaw|alaw|vp8), peer - audio=(ulaw|alaw)/video=(vp8)/text=(nothing), combined - (ulaw|alaw|vp8)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 192.168.2.143:20002
Peer video RTP is at port 192.168.2.143:43002
set_destination: Parsing sip:android@192.168.2.143:5062 for address/port to send to
set_destination: set destination to 192.168.2.143:5062
Transmitting (no NAT) to 192.168.2.143:5062:
ACK sip:android@192.168.2.143:5062 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.94:5060;branch=z9hG4bK2c4730d9;rport
Max-Forwards: 70
From: sip:inosmart@192.168.2.111;tag=as4120b037
To: "android"sip:android@192.168.2.111;tag=f694b840
Contact: sip:inosmart@192.168.2.94:5060
Call-ID: TMvt7xa8oh3tc8MF6vvoZA…
CSeq: 102 ACK
User-Agent: Asterisk PBX 13.15.0
Content-Length: 0


<— SIP read from UDP:192.168.2.143:5062 —>
REGISTER sip:192.168.2.111 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.143:5062;branch=z9hG4bK-524287-1—b0ec425fdd730e19;rport
Max-Forwards: 70
Contact: sip:android@192.168.2.143:5062;+sip.instance="urn:uuid:CC7B38C1-0F0F-D04F-AB3A-343BC01AF8AC"
To: "android"sip:android@192.168.2.111
From: "android"sip:android@192.168.2.111;tag=93b0487d
Call-ID: xu5fbgRB3Gb80aMrQlRA5g…
CSeq: 3 REGISTER
Expires: 90
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, REGISTER, SUBSCRIBE, INFO, PUBLISH
Supported: replaces, outbound, path
User-Agent: PortSIP SDK for Android
Authorization: Digest username=“android”,realm=“asterisk”,nonce=“42d71529”,uri=“sip:192.168.2.111”,response=“c5c3546dbb639aaadbf63f8c3ebb5fd9”,algorithm=MD5
Allow-Events: hold, talk, conference
Content-Length: 0

<------------->
— (15 headers 0 lines) —
Sending to 192.168.2.143:5062 (no NAT)
Sending to 192.168.2.143:5062 (no NAT)

<— Transmitting (no NAT) to 192.168.2.143:5062 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.2.143:5062;branch=z9hG4bK-524287-1—b0ec425fdd730e19;received=192.168.2.143;rport=5062
From: "android"sip:android@192.168.2.111;tag=93b0487d
To: "android"sip:android@192.168.2.111;tag=as78246eff
Call-ID: xu5fbgRB3Gb80aMrQlRA5g…
CSeq: 3 REGISTER
Server: Asterisk PBX 13.15.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="35b68ff9"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘xu5fbgRB3Gb80aMrQlRA5g…’ in 32000 ms (Method: REGISTER)

<— SIP read from UDP:192.168.2.143:5062 —>
REGISTER sip:192.168.2.111 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.143:5062;branch=z9hG4bK-524287-1—da76fe12cc874a28;rport
Max-Forwards: 70
Contact: sip:android@192.168.2.143:5062;+sip.instance="urn:uuid:CC7B38C1-0F0F-D04F-AB3A-343BC01AF8AC"
To: "android"sip:android@192.168.2.111
From: "android"sip:android@192.168.2.111;tag=93b0487d
Call-ID: xu5fbgRB3Gb80aMrQlRA5g…
CSeq: 4 REGISTER
Expires: 90
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, REGISTER, SUBSCRIBE, INFO, PUBLISH
Supported: replaces, outbound, path
User-Agent: PortSIP SDK for Android
Authorization: Digest username=“android”,realm=“asterisk”,nonce=“35b68ff9”,uri=“sip:192.168.2.111”,response=“8026f28d6ec730a762635a23783f28be”,algorithm=MD5
Allow-Events: hold, talk, conference
Content-Length: 0

<------------->
— (15 headers 0 lines) —
Sending to 192.168.2.143:5062 (no NAT)
Reliably Transmitting (no NAT) to 192.168.2.143:5062:
OPTIONS sip:android@192.168.2.143:5062 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.94:5060;branch=z9hG4bK3a8b7e9c
Max-Forwards: 70
From: “asterisk” sip:asterisk@192.168.2.94;tag=as08a36c81
To: sip:android@192.168.2.143:5062
Contact: sip:asterisk@192.168.2.94:5060
Call-ID: 0d627d305a8f70b461cfeed20c33d9d3@192.168.2.94:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.15.0
Date: Sun, 10 Dec 2017 20:16:45 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<— Transmitting (no NAT) to 192.168.2.143:5062 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.143:5062;branch=z9hG4bK-524287-1—da76fe12cc874a28;received=192.168.2.143;rport=5062
From: "android"sip:android@192.168.2.111;tag=93b0487d
To: "android"sip:android@192.168.2.111;tag=as78246eff
Call-ID: xu5fbgRB3Gb80aMrQlRA5g…
CSeq: 4 REGISTER
Server: Asterisk PBX 13.15.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Expires: 90
Contact: sip:android@192.168.2.143:5062;expires=90
Date: Sun, 10 Dec 2017 20:16:45 GMT
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘xu5fbgRB3Gb80aMrQlRA5g…’ in 32000 ms (Method: REGISTER)

<— SIP read from UDP:192.168.2.143:5062 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.94:5060;branch=z9hG4bK3a8b7e9c
Contact: sip:192.168.2.143:5062
To: sip:android@192.168.2.143:5062;tag=dbadd548
From: “asterisk” sip:asterisk@192.168.2.94;tag=as08a36c81
Call-ID: 0d627d305a8f70b461cfeed20c33d9d3@192.168.2.94:5060
CSeq: 102 OPTIONS
Accept: application/sdp, multipart/mixed, multipart/signed, multipart/alternative, application/vnd.3gpp.cw+xml
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, REGISTER, SUBSCRIBE, INFO, PUBLISH
Supported: replaces, outbound, path
User-Agent: PortSIP SDK for Android
Allow-Events: hold, talk, conference
Content-Length: 0

<------------->
— (13 headers 0 lines) —
Really destroying SIP dialog ‘0d627d305a8f70b461cfeed20c33d9d3@192.168.2.94:5060’ Method: OPTIONS

<— SIP read from UDP:192.168.2.143:5062 —>
BYE sip:inosmart@192.168.2.94:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.143:5062;branch=z9hG4bK-524287-1—03e49022f8b9a309;rport
Max-Forwards: 70
Contact: sip:android@192.168.2.143:5062;+sip.instance="urn:uuid:CC7B38C1-0F0F-D04F-AB3A-343BC01AF8AC"
To: sip:inosmart@192.168.2.111;tag=as4120b037
From: "android"sip:android@192.168.2.111;tag=f694b840
Call-ID: TMvt7xa8oh3tc8MF6vvoZA…
CSeq: 3 BYE
User-Agent: PortSIP SDK for Android
Authorization: Digest username=“android”,realm=“asterisk”,nonce=“27bda2c9”,uri=“sip:inosmart@192.168.2.94:5060”,response=“9818621b910ca0e4245cf15705699a9f”,algorithm=MD5
Content-Length: 0

<------------->
— (11 headers 0 lines) —
Sending to 192.168.2.143:5062 (no NAT)
Scheduling destruction of SIP dialog ‘TMvt7xa8oh3tc8MF6vvoZA…’ in 6400 ms (Method: BYE)

<— Transmitting (no NAT) to 192.168.2.143:5062 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.143:5062;branch=z9hG4bK-524287-1—03e49022f8b9a309;received=192.168.2.143;rport=5062
From: "android"sip:android@192.168.2.111;tag=f694b840
To: sip:inosmart@192.168.2.111;tag=as4120b037
Call-ID: TMvt7xa8oh3tc8MF6vvoZA…
CSeq: 3 BYE
Server: Asterisk PBX 13.15.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------>
– Channel SIP/android-0000001b left ‘native_rtp’ basic-bridge <96a1c106-b275-4544-93a7-f4a2d7125dbe>
set_destination: Parsing sip:inosmart@192.168.2.111:5071 for address/port to send to
set_destination: set destination to 192.168.2.111:5071
Audio is at 11600
Video is at 192.168.2.111:13038
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding video codec vp8 to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 192.168.2.111:5071:
INVITE sip:inosmart@192.168.2.111:5071 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.111:5060;branch=z9hG4bK2f4f926c
Max-Forwards: 70
From: “android” sip:android@192.168.2.111;tag=as3913dcc2
To: sip:inosmart@192.168.2.111:5071;tag=TKAlRUS
Contact: sip:android@192.168.2.111:5060
Call-ID: 57008a4219bdb55e19e2269e1feb8f19@192.168.2.111:5060
CSeq: 104 INVITE
User-Agent: Asterisk PBX 13.15.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
X-asterisk-Info: SIP re-invite (External RTP bridge)
Content-Type: application/sdp
Content-Length: 360

v=0
o=root 1595115688 1595115690 IN IP4 192.168.2.111
s=Asterisk PBX 13.15.0
c=IN IP4 192.168.2.111
b=CT:384
t=0 0
m=audio 11600 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv
m=video 13038 RTP/AVP 120
a=rtpmap:120 VP8/90000
a=rtcp-fb:* ccm fir
a=sendrecv


== Spawn extension (phones, inosmart, 2) exited non-zero on ‘SIP/android-0000001b’
– Channel SIP/inosmart-0000001c left ‘native_rtp’ basic-bridge <96a1c106-b275-4544-93a7-f4a2d7125dbe>
Scheduling destruction of SIP dialog ‘57008a4219bdb55e19e2269e1feb8f19@192.168.2.111:5060’ in 6400 ms (Method: INVITE)

<— SIP read from UDP:192.168.2.111:5071 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.2.111:5060;branch=z9hG4bK2f4f926c
From: “android” sip:android@192.168.2.111;tag=as3913dcc2
To: sip:inosmart@192.168.2.111:5071;tag=TKAlRUS
Call-ID: 57008a4219bdb55e19e2269e1feb8f19@192.168.2.111:5060
CSeq: 104 INVITE

<------------->
— (6 headers 0 lines) —

<— SIP read from UDP:192.168.2.111:5071 —>
SIP/2.0 200 Ok
Via: SIP/2.0/UDP 192.168.2.111:5060;branch=z9hG4bK2f4f926c
From: “android” sip:android@192.168.2.111;tag=as3913dcc2
To: sip:inosmart@192.168.2.111:5071;tag=TKAlRUS
Call-ID: 57008a4219bdb55e19e2269e1feb8f19@192.168.2.111:5060
CSeq: 104 INVITE
User-Agent: (belle-sip/1.4.2)
Supported: outbound
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, UPDATE
Contact: sip:inosmart@192.168.2.111:5071;+sip.instance="urn:uuid:ba3a9e4c-ff1b-4a19-8d29-bf7df6d51407"
Content-Type: application/sdp
Content-Length: 200

v=0
o=inosmart 317 390 IN IP4 192.168.2.111
s=Talk
c=IN IP4 192.168.2.111
t=0 0
m=audio 7078 RTP/AVP 0 8 101
a=rtpmap:101 telephone-event/8000
m=video 9078 RTP/AVP 120
a=rtpmap:120 VP8/90000
<------------->
— (12 headers 9 lines) —
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 101
Found audio description format telephone-event for ID 101
Found RTP video format 120
Found video description format VP8 for ID 120
Capabilities: us - (ulaw|alaw|vp8), peer - audio=(ulaw|alaw)/video=(vp8)/text=(nothing), combined - (ulaw|alaw|vp8)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 192.168.2.111:7078
Peer video RTP is at port 192.168.2.111:9078
set_destination: Parsing sip:inosmart@192.168.2.111:5071 for address/port to send to
set_destination: set destination to 192.168.2.111:5071
Transmitting (no NAT) to 192.168.2.111:5071:
ACK sip:inosmart@192.168.2.111:5071 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.111:5060;branch=z9hG4bK700660d3
Max-Forwards: 70
From: “android” sip:android@192.168.2.111;tag=as3913dcc2
To: sip:inosmart@192.168.2.111:5071;tag=TKAlRUS
Contact: sip:android@192.168.2.111:5060
Call-ID: 57008a4219bdb55e19e2269e1feb8f19@192.168.2.111:5060
CSeq: 104 ACK
User-Agent: Asterisk PBX 13.15.0
Content-Length: 0

Your configuration is incorrect:

outofcall_message_contex=inomsg

You are missing the “t” at the end of context.

You need your phones to use the [inomsg] context, while they are using the [phones] context. You are dialing “android” extension, while the allowed extension mapping for [inomsg] is only three digits (XXX)

Try replacing exten => _XXX with exten => android

I see also a small discrepancy between the logs and your dialplan, are you sure to have reloaded asterisk dialplan after latest changes?

Which phone are you using to send SIP MESSAGE?

I changed both conf and reload them. Now it is only one context PHONES, but stil can not recive message.
I try to send message out of the call and in call. Same result

SIP
[general]
context=public
allowoverlap=no
tcpenable=no
tcpbindaddr=0.0.0.0
transport=udp
srvlookup=no
bindport=5060
videosupport=yes
accept_outofcall_message=yes
outofcall_message_context=phones
auth_message_request=no
directmedia=nonat,update

EXTENSIONS
[phones]
exten => android,1,NoOp(Calling android)
same => n,Dial(SIP/android)
same => n,HangUp

exten => inosmart,1,NoOp(Calling inosmart))
same => n,Dial(SIP/inosmart)
same => n,HangUp

exten => android,1,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => android,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => android,n,Hangup

exten => inosmart,1,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => inosmart,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => inosmart,1,Hangup

Asterisk console:

== Using SIP VIDEO CoS mark 6
== Using SIP RTP CoS mark 5
– Called SIP/inosmart
– SIP/inosmart-00000030 answered SIP/android-0000002f
– Channel SIP/inosmart-00000030 joined ‘simple_bridge’ basic-bridge <6b1134cf-a88a-4d02-b0d9-dd272188ed45>
– Channel SIP/android-0000002f joined ‘simple_bridge’ basic-bridge <6b1134cf-a88a-4d02-b0d9-dd272188ed45>
> Bridge 6b1134cf-a88a-4d02-b0d9-dd272188ed45: switching from simple_bridge technology to native_rtp
> Remotely bridged ‘SIP/android-0000002f’ and ‘SIP/inosmart-00000030’ - media will flow directly between them
> Remotely bridged ‘SIP/android-0000002f’ and ‘SIP/inosmart-00000030’ - media will flow directly between them
> 0x2b130f0 – Probation passed - setting RTP source address to 192.168.2.111:7078
> 0x75f217c0 – Probation passed - setting RTP source address to 192.168.2.143:43020
– Executing [android@phones:1] NoOp(“Message/ast_msg_queue”, “Klicem android”) in new stack
– Executing [android@phones:2] Dial(“Message/ast_msg_queue”, “SIP/android”) in new stack
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [android@phones:3] Hangup(“Message/ast_msg_queue”, “”) in new stack
== Spawn extension (phones, android, 3) exited non-zero on ‘Message/ast_msg_queue’
> 0x75f19658 – Probation passed - setting RTP source address to 192.168.2.143:20020
– Executing [inosmart@phones:1] NoOp(“Message/ast_msg_queue”, “Klicem inosmart)”) in new stack
– Executing [inosmart@phones:2] Dial(“Message/ast_msg_queue”, “SIP/inosmart”) in new stack
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [inosmart@phones:3] Hangup(“Message/ast_msg_queue”, “”) in new stack
== Spawn extension (phones, inosmart, 3) exited non-zero on ‘Message/ast_msg_queue’
– Executing [inosmart@phones:1] NoOp(“Message/ast_msg_queue”, “Klicem inosmart)”) in new stack
– Executing [inosmart@phones:2] Dial(“Message/ast_msg_queue”, “SIP/inosmart”) in new stack
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [inosmart@phones:3] Hangup(“Message/ast_msg_queue”, “”) in new stack
== Spawn extension (phones, inosmart, 3) exited non-zero on ‘Message/ast_msg_queue’

Using a distinct context for the SIP MESSAGES was good, I don’t think it is a good idea to use the same context for both SIP MESSAGES and SIP CALLS. Please set back

outofcall_message_context=inomsg

[inomsg]
exten => android,1,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => android,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => android,n,Hangup

exten => inosmart,1,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => inosmart,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => inosmart,n,Hangup

I set it back and it works now!
THANKS

[SMS]
exten => 4000,1,NoOp(1|Extension 4000)
exten => 4000,n,DeadAGI(SMS.php)
exten => 4000,Dial(SIP/4000)
exten => 4000,HangUp

exten => h,1,DeadAgi(SMS.php)

exten => 5000,1,NoOp(1|Extension 5000)
exten => 5000,n,DeadAGI(SMS.php)
exten => 5000,Dial(SIP/5000)
exten => 5000,HangUp

exten => h,1,DeadAgi(SMS.php)

exten => 4000,1,Set(ACTUALTO={CUT(MESSAGE(to),@,1)}) exten => 4000,n,DeadAGI(SMS.php) exten => 4000,n,MessageSend({ACTUALTO},${MESSAGE(from)})
exten => 4000,n,Hangup

exten => h,1,DeadAgi(SMS.php)

exten => 5000,1,Set(ACTUALTO={CUT(MESSAGE(to),@,1)}) exten => 5000,n,DeadAGI(SMS.php) exten => 5000,n,MessageSend({ACTUALTO},${MESSAGE(from)})
exten => 5000,1,Hangup

exten => h,1,DeadAgi(SMS.php)

I don,t know where I did wrong , when I send message to 4000 to 5000 Message will not send , when after call hangup

You have multiple first index for your exensions 4000 and 5000.
I reccomend to use same => n,…. Like:

exten => 5000,1,Answer

same => n,NoOp(before hangup)

exten => h,1,DeadAGI(sms.php)

same => n,Hangup