--- asterisk-1.6.2.9/channels/chan_sip.c.orig 2010-06-22 21:22:16.000000000 -0400 +++ asterisk-1.6.2.9/channels/chan_sip.c 2010-06-22 21:24:10.000000000 -0400 @@ -7471,12 +7471,13 @@ /* See if the method is capable of creating a dialog */ if (sip_methods[intended_method].can_create == CAN_CREATE_DIALOG) { + const char *event = get_header(req, "Event"); if (intended_method == SIP_REFER) { /* We do support REFER, but not outside of a dialog yet */ transmit_response_using_temp(callid, sin, 1, intended_method, req, "603 Declined (no dialog)"); - } else if (intended_method == SIP_NOTIFY) { - /* We do not support out-of-dialog NOTIFY either, - like voicemail notification, so cancel that early */ + } else if (intended_method == SIP_NOTIFY && (!event || strcmp(event, "keep-alive"))) { + /* We do not support out-of-dialog NOTIFY either, unless it is a + * keep-alive, like voicemail notification, so cancel that early */ transmit_response_using_temp(callid, sin, 1, intended_method, req, "489 Bad event"); } else { /* Ok, time to create a new SIP dialog object, a pvt */