The REFER I get:
REFER sip:44555202@172.16.16.141:9781;transport=udp SIP/2.0
Via: SIP/2.0/UDP 172.16.16.130:5060;branch=z9hG4bK-524287-1---cca7663c48d77f3a;rport
Via: SIP/2.0/UDP 192.168.63.72:5061;branch=z9hG4bK-2b6d69c5
Max-Forwards: 69
Contact: <sip:44111200@192.168.63.72:5061>
To: <sip:44555202@172.16.16.130>;tag=a1r2KaQ5Q3vUm
From: <sip:44111200@172.16.16.130>;tag=33099d38e40eb484o1
Call-ID: b0184248-ae01d2b4@192.168.63.72
CSeq: 103 REFER
User-Agent: Cisco/SPA504G-7.6.0
Refer-To: <sip:44555204@172.16.16.130?Replaces=e1d8e9ed-f4fa54d8%40192.168.63.72%3Bfrom-tag%3D7fbc6ee9cfb6340co1%3Bto-tag%3DBajUN578mcKeg>
Referred-By: <sip:44111200@172.16.16.130>
Content-Length: 0
The part of RFC 3515 saying a body is not mandatory:
2.3 Message Body Inclusion
A REFER method MAY contain a body. This specification assigns no
meaning to such a body. A receiving agent may choose to process the
body according to its Content-Type.
Original code not firing the event if the REFER does not have a body+content-type:
if (sip->sip_content_type &&
sip->sip_content_type->c_type && sip->sip_payload && sip->sip_payload->pl_data && !strcasecmp(sip->sip_event->o_type, "refer")) {
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_NOTIFY_REFER) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "content-type", sip->sip_content_type->c_type);
switch_event_add_body(s_event, "%s", sip->sip_payload->pl_data);
}
}
What I think the code should be like to cope with a REFER without a body (not tested yet):
if (!strcasecmp(sip->sip_event->o_type, "refer")) {
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_NOTIFY_REFER) == SWITCH_STATUS_SUCCESS) {
if (sip->sip_content_type && sip->sip_content_type->c_type && sip->sip_payload && sip->sip_payload->pl_data) {
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "content-type", sip->sip_content_type->c_type);
switch_event_add_body(s_event, "%s", sip->sip_payload->pl_data);
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}