[Freeswitch-users] LED-Controlling on Snom phones. Missing Subject header
Brian West
brian at freeswitch.org
Thu Jun 10 13:47:54 PDT 2010
diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c
index 026ae42..1d274c2 100644
--- a/src/mod/endpoints/mod_sofia/mod_sofia.c
+++ b/src/mod/endpoints/mod_sofia/mod_sofia.c
@@ -4082,6 +4082,7 @@ static void general_event_handler(switch_event_t *event)
const char *ct = switch_event_get_header(event, "content-type");
const char *user = switch_event_get_header(event, "user");
const char *host = switch_event_get_header(event, "host");
+ const char *subject = switch_event_get_header(event, "subject");
const char *body = switch_event_get_body(event);
sofia_profile_t *profile;
nua_handle_t *nh;
@@ -4114,7 +4115,10 @@ static void general_event_handler(switch_event_t *event)
nh = nua_handle(profile->nua,
NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(profile->url), TAG_END());
- nua_message(nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR(ct), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END());
+ nua_message(nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR(ct),
+ TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
+ TAG_IF(!zstr(subject), SIPTAG_SUBJECT_STR(subject)),
+ TAG_END());
free(id);
This should work... please try it yourself.
I'll push this later if that works.
/b
On Jun 10, 2010, at 3:38 PM, Helmut Kuper wrote:
> Hello,
>
> I try to control the LEDs on Snom 370 phones using LUA and event type
> SEND_MESSAGE. The phone receives this message:
>
> MESSAGE sip:2850 at 85.16.245.213:1051 SIP/2.0
> Via: SIP/2.0/UDP 85.16.246.6;rport;branch=z9hG4bKeer7H9cFa85DN
> Max-Forwards: 70
> From: <sip:2850 at 85.16.246.6>;tag=yH2p954XZZ1tj
> To: <sip:2850 at 85.16.246.6>
> Call-ID: 2a6ed9ba-ef6d-122d-3d83-00144fe6e332
> CSeq: 131979517 MESSAGE
> Contact: <sip:mod_sofia at 85.16.246.6:5060>
> User-Agent: FreeSWITCH-mod_sofia/1.0.head-17097:17188M
> Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO,
> REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
> Supported: timer, precondition, path, replaces
> Content-Type: application/x-buttons
> Content-Length: 10
>
> k=1
> c=on
>
>
>
> and Snom acknowledges this with 200 OK. Unfortunately nothing happens.
>
> Snom's howto (http://wiki.snom.com/Category:HowTo:LED_Remote_Control)
> describes a message like this:
>
> MESSAGE sip:44 at 172.20.25.101:2048;transport=tls;line=44qsudyt SIP/2.0
> Via: SIP/2.0/TLS
> 172.20.25.102:5061;branch=z9hG4bK-2909fe081f8466c9836c3b673f284842;rport
> From: <sip:44 at localhost>;tag=17820
> To: <sip:44 at localhost>
> Call-ID: umceg9jb at pbx
> CSeq: 35160 MESSAGE
> Max-Forwards: 70
> Contact: <sip:172.20.25.102:5061;transport=tls>
> Subject: buttons
> Content-Type: application/x-buttons
> Content-Length: 7
>
> k=3
> l=42
>
>
> Main difference is the subject header containing "buttons" (despite of
> the body)
>
> Is there a way to add subject header as above to the message generated
> by FS?
>
> regards
> Helmut
>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
More information about the FreeSWITCH-users
mailing list