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.

How to size voice bandwidth without guessing

Voice bandwidth is one of the few capacity questions in IT that can be answered with arithmetic instead of judgement. The calculation needs three inputs: codec bit rate, packetisation interval, and expected concurrent calls.

  • The codec bit rate is the compressed payload of one call. G.711 sits at the top of the range, and the lower-rate codecs sit well below it.
  • Packetisation determines how often that payload is sent. Smaller packets mean more overhead but less latency.
  • Add per-call overhead for transport, and then multiply by the number of simultaneous calls you expect at peak — not by the number of registered extensions.

The number of extensions is a licensing question. The number of concurrent calls is a bandwidth question, and conflating the two is one of the most common sizing mistakes. For a worked example of the calculation applied to a real growth pattern, see What an IP-PBX Actually Costs: Line Items People Forget.

Voice VLAN and QoS: the two settings that matter most

Most call-quality problems on a converged network are caused by voice traffic competing with something else that happened to be busier at that moment.

Two configuration choices address most of it. The first is putting voice on its own VLAN, so that a broadcast storm or a large file transfer on the data VLAN cannot consume the queue that carries calls. The second is marking voice traffic at the access port and trusting that mark upstream, so that the priority decision is made once, at the edge, where you can see the device.

  • Mark voice traffic at the access port rather than re-marking it in the core, which avoids trust conflicts between switches.
  • Apply the priority to the queue that carries RTP, not just to the SIP signalling traffic — signalling without media priority does little when the media queue is congested.
  • Watch the queue behaviour during real congestion rather than only at idle, because problems that only appear under load are exactly the ones users report.
  • Include wireless access points in the scope; a soft client on Wi-Fi behaves differently from a wired desk phone.

A dedicated path for voice also makes monitoring meaningful, because you can then distinguish a voice problem from a general network problem without guessing.

Related reading on the Newrock site

Customer-centric, focus on customer value

Consult now

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