Asterisk initiate call through sip notify message

1

I have a Yealink ip phone on my desk and I want to remote control it so that I can place the calls from my computer instead than by typing the numbers directly on the phone. This link explains how to do it:

How to dial or place a call using remote control | Yealink Support

There are 2 ways of doing it. One is sending a http request to the phone. And the other option is by sending a SIP notify message.

A) Sending HTTP request (Works!)

  1. First make sure the phone is configured to allow remote connections

enter image description here

  1. Then just make this wget request

    wget --user admin --password PASSWORD_PHONE  http://IP_OF_PHONE/servlet?key=SPEAKER
    

After making that request the phone speaker key is pressed!


B) Sending SIP Notify Message (Does NOT work)

This is the option I want to use because I do not want to store usernames and passwords. Also the ip address of the phone might change. Anyways here is what I have tried and for some reason I cannot make this option work:

  1. I perform the first step that I did on part (A) by allowing the phone to be remote controled.

  2. I connect the phone to my asterisk server and make sure it is connected. enter image description here

  3. Now that the SIP peer Eduardo is connected I need to send it a SIP Notify Message with the body containing key=SPEAKER.

  4. I open /etc/asterisk/sip_notify.conf and add the following context:

    [test] Event=>ACTION-URI Content=>key=SPEAKER

  5. I restart asterisk because I do not know how to reload sip_notify.conf

    asterisk -rx "core restart gracefully"
    
  6. Then on asterisk CLI I type the following command in order to send the sip notify message:

    sip notify test Eduardo
    
  7. when I run that command asterisk says: Sending NOTIFY of type 'test' to 'Eduardo' but the phone never presses the SPEAKER key! What could I be doing wrong?

  8. Here is the sip message captured by Wireshark!

enter image description here

  1. Even though I am following the directions the SPEAKER key is not being pressed! What could I be doing wrong?

Helpful Info:

enter image description here

Tono Nam

Posted 2017-11-04T01:56:03.753

Reputation: 451

Answers

1

After trying all day I was able to figure it out! I was missing the content-type header!

Anyways here is the solution:

  1. sip_notify.conf file should contain:

    [test]
    Content-Type=>message/sipfrag
    Event=>ACTION-URI
    Content=>key=SPEAKER
    

    The line Content-Type=>message/sipfrag is very important!

  2. Restart asterisk so that sip_notify.conf reloads

    asterisk -rx "core restart gracefully"

  3. Now type this asterisk command:

    sip notify test Eduardo
    

    where Eduardo is the SIP peer you want to send the key to

  4. A list of all the available keys can be found in here:

    http://support.yealink.com/faq/faqInfo?id=173

Tono Nam

Posted 2017-11-04T01:56:03.753

Reputation: 451