0

I have an IP phone, which seems to be all standard SIP, but when you pick up the receiver, it sends "MESSAGE" to the server.

If it receives a "200 OK", then it proceeds to work fine, and using valid SIP it seems, but if it receives an error (which Asterisk ultimately produces, as it's not quite a valid sequence, making it respond with a "406 Not Acceptable"), it refuses to work at all.

Is there any way I could alter Asterisk to respond "200 OK" for "MESSAGE" for a particular user, without rebuilding Asterisk itself from sources, or adding any kind of proxy inbetween?

akasaka
  • 310
  • 1
  • 14
  • What's the purpose of the MESSAGE message, what does its body contain? Can you configure the phone NOT to send the message when you pick it up? – Bucq Nov 14 '18 at 13:33
  • @Bucq the body is empty, and no, I can't turn it off on the phone (otherwise I would just do that). It's pretty much vendor lock-in. This phone was designed for use with a satellite phone system, so I think they just use MESSAGE to check whether there is a line available, i.e. if the response is OK, then you can call, and whatever else, the communication to the satellite is disrupted, so no go. – akasaka Nov 14 '18 at 23:17
  • It's a Fujitsu SS-170A for those playing along at home – akasaka Nov 14 '18 at 23:19

2 Answers2

2

I can suggest following option

1) try setup context for message sip.conf

accept_outofcall_message = yes
outofcall_message_context = messages
auth_message_requests = no

extensions.conf

[messages]
exten => _XXX,1,Hangup

2) setup kamailio as proxy before asterisk, create messages loop on kamailio, register your device on kamailio.

arheops
  • 15,544
  • 1
  • 21
  • 27
  • Possibly related: https://stackoverflow.com/questions/33169653/asterisk-incoming-message-gives-415-unsupported-media-type – akasaka Nov 15 '18 at 13:46
  • Indeed it was. Instead of rebuilding asterisk I just blatantly patched that line with a hex editor to respond "200 OK" and a bunch of spaces, and it worked in a pinch. – akasaka Nov 15 '18 at 14:32
0

While the response by @arheops didn't work, it was certainly helpful in pointing me in the right direction.

The phone pretty much sends the MESSAGE without any content, and not even Content-Type.

<--- SIP read from UDP:<Phone External IP>:5060 --->
MESSAGE sip:1014@<Server Internal IP>:5060;user=phone SIP/2.0
Via: SIP/2.0/UDP <Phone Internal IP>:5060;branch=z9hG4bK2621781087c1096064fa949
From: "1014" <sip:1014@<Server Internal IP>:5060;user=phone>;tag=2621781087c1096064fa949;fjline-hunt=ML-141
To: <sip:1014@<Server Internal IP>:5060;user=phone>
CSeq: 1 MESSAGE
Call-ID: 00062621781087c1096064fa94900@<Phone Internal IP>
Content-Length: 0
Max-Forwards: 70
User-Agent: Fujitsu SS-170A/B/C V02L001C06

<------------->
--- (9 headers 0 lines) ---

In the end I found this question: Asterisk incoming message gives: 415 unsupported media type

Which states that without a content-type of text/plain, Asterisk refuses a Message right away.

Of course the proper way would be to indeed clone Asterisk and rebuild it from source, but considering the time limit (and laziness) I just used Hopper to find the offset to the string literal after "text/plain", and just make it respond with a 200 OK (bunch of spaces at the end).

And now I can easily call anyone from this phone!

Incoming calls, however, don't work: it responds with an OK to a Notify, but does nothing, and Asterisk redirects the call to voicemail.

And I can't check voicemail either, because it won't send DTMF inband or out of band.

To cut a long story short: don't buy a SIP phone on a shady used electronics sale just because it's cheap and looks cool, vendor-specific protocols can be a PITA.

akasaka
  • 310
  • 1
  • 14
  • put qualify=no in extension settings, asterisk will not send notify at all. You also can change notify to option in sip.conf. – arheops Nov 15 '18 at 17:27
  • @arheops, wouldn't it break any other phones like the ATA186 (which are most used on my PBX)? Or is NOTIFY not the message used for incoming calls? It seems NOTIFY has Voicemail info rather than the calls... – akasaka Nov 15 '18 at 22:54
  • qualify is section option. i.e per extension. – arheops Nov 16 '18 at 05:17