News

News

Understanding SIP CANCEL and BYE Messages: How VoIP Calls End Properly

Anyone managing a business phone system has seen bad call teardown symptoms: a customer hears ringing that never stops, a trunk stays busy even though both parties hung up, or billing charges for a five-minute call that was answered in two seconds. Behind these issues are the SIP signaling messages that govern how a VoIP call is established and, crucially, how it ends. The two most important termination messages are CANCEL and BYE. They sound similar but serve fundamentally different roles in the SIP lifecycle. Understanding when each is used and why correct implementation matters is essential for anyone deploying or troubleshooting a SIP trunk, IP PBX, or call center platform.

What Is a SIP BYE Message and When Is It Used?

BYE is the standard SIP method for ending a fully connected call. In SIP terms, a call is connected once the called party has sent a 200 OK to the INVITE and the calling party has acknowledged it with an ACK. The media session is then active, with both sides exchanging RTP audio or video. When either party hangs up, their user agent sends a BYE request within the established dialog. The far end responds with 200 OK, the dialog is torn down, and the RTP stream stops.

Because BYE operates inside an existing dialog, it contains all call identifiers needed for proxies, Session Border Controllers, and billing systems to match the disconnect to the original record. Accurate BYE handling directly affects CDR (Call Detail Record) accuracy and trunk utilization. If BYE is lost or never generated, the SBC or carrier may continue counting minutes until an inactivity timer expires, inflating bills and occupying trunk capacity. These phantom, stuck calls are often called "ghost lines."

What Is a SIP CANCEL Message and When Is It Used?

Whereas BYE ends an active call, CANCEL terminates an INVITE transaction before the call is answered. Imagine a customer dials a support line, hears several rings, then hangs up before an agent picks up. The original INVITE is still in progress at the proxy, and without CANCEL, the network would continue ringing until a timer expires. To avoid wasting resources, the caller's user agent sends a CANCEL request that matches the pending INVITE. The proxy or called user agent then stops alerting and returns a 487 Request Terminated, followed by the usual ACK.

A critical detail about CANCEL is that it is effectively hop-by-hop: it must traverse the same proxies as the original INVITE and can only be issued by the side that originated it. If an intermediate proxy receives a CANCEL, it must propagate it downstream and generate its own 487 for any branches it created. Proper CANCEL handling preserves trunk resources and avoids false missed-call alerts, while poor implementation is a frequent cause of "one-way audio" and stuck gateway ports.

Why Correct Call Teardown Prevents Billing Errors and Ghost Lines

The practical difference between CANCEL and BYE boils down to billing, capacity, and user experience. Most providers charge only for answered calls, so an INVITE CANCELed before 200 OK should not appear on the invoice. If a gateway mistakenly sends BYE instead of CANCEL, or a proxy incorrectly flags a CANCELed call as answered, the business can be billed for thousands of unanswered attempts. The reverse is also a problem: if BYE is never delivered because a firewall closes the SIP port prematurely, the carrier keeps the call active and the customer pays for minutes no one is talking.

Operational capacity suffers too. Each active SIP dialog ties up memory, DSP resources, and trunk licenses on the IP PBX or SBC. A busy call center can exhaust its license pool if CANCEL messages are dropped. For organizations connecting to the PSTN through T1/E1 or FXO gateways, improper disconnect signaling can leave physical channels off-hook, resulting in "all lines busy" even though no calls are active. Monitoring CANCEL and BYE success rates is therefore a key health metric for any production VoIP deployment.

New Rock Technologies designs IP PBXs, Session Border Controllers, and VoIP gateways with strict RFC-compliant SIP CANCEL and BYE handling, including retransmission timers, reliable provisional response support, and PSTN-side disconnect supervision. New Rock platforms help operators reduce ghost calls, eliminate incorrect billing, and keep trunks running at peak efficiency.

In summary, SIP BYE ends a call that has already been answered, while SIP CANCEL terminates a ringing INVITE before the called party picks up. Each has a distinct place in the SIP call lifecycle, and correct implementation on user agents, proxies, and gateways is vital for accurate billing, efficient trunk utilization, and a frustration-free calling experience. By choosing equipment that adheres closely to SIP standards, businesses can avoid the most common call teardown pitfalls and keep their VoIP system running cleanly.

Customer-centric, focus on customer value

Consult now

Copyright © New Rock Technologies, Inc. All Rights Reserved. 沪ICP备15008515号-1