{"id":7092,"date":"2025-02-14T16:07:55","date_gmt":"2025-02-14T05:07:55","guid":{"rendered":"https:\/\/nickvsnetworking.com\/?p=7092"},"modified":"2025-01-19T07:40:00","modified_gmt":"2025-01-18T20:40:00","slug":"basic-camel-charging-flow","status":"publish","type":"post","link":"https:\/\/nickvsnetworking.com\/basic-camel-charging-flow\/","title":{"rendered":"Basic CAMEL Charging Flow"},"content":{"rendered":"\n<p>CAMEL handles charging in 2G and 3G networks, <a href=\"https:\/\/nickvsnetworking.com\/basics-of-epc-lte-online-charging-ocs\/\" data-type=\"post\" data-id=\"3857\">much like Diameter handles charging in LTE.<\/a><\/p>\n\n\n\n<p>CAMEL <a href=\"https:\/\/nickvsnetworking.com\/practical-ss7-sigtran-with-labs-part-1-intro\/\" data-type=\"post\" data-id=\"4339\">runs on top of SS7<\/a>, specifically it sits on top of<a href=\"https:\/\/nickvsnetworking.com\/practical-ss7-sigtran-part-4-mtp2-m2ua-m2pa\/\" data-type=\"post\" data-id=\"4376\"> TCAP, which sits on top of SCCP, which can ride on M3UA or MTP3<\/a> (so it sits at the same layer as MAP).<\/p>\n\n\n\n<p>CAMEL is primarily focused on charging for Voice &amp; SMS services, as data generally uses Diameter, so it&#8217;s voice and SMS we&#8217;ll focus on.<\/p>\n\n\n\n<p>CAMEL is spoken between the MSC (gsmSSF) and the OCS (gsmSCF).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Basic Call State Model<\/h2>\n\n\n\n<p>CAMEL is closely related to the Intelligent Network stuff on the 1980s, and steals a lot of it&#8217;s ideas from there, unfortunately if you&#8217;re to read the CAMEL standard it also implies you were involved in IN stuff and had been born at that point, alas I was neither.<\/p>\n\n\n\n<p>So the key to understanding CAMEL is the Basic Call State Model (BCSM) which is a model of all the different states a call can be in, such as ringing, answered, abandoned, call failed, etc, etc.<\/p>\n\n\n\n<p>Over CAMEL, our OCS can be told by the MSC when a certain event happens; the MSC can tell the OCS, that the call has changed state. For example a BCSM event might indicate the call has hung up, is ringing, cancelled, etc.<\/p>\n\n\n\n<p>Below is the list of all the valid BCSM states:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"989\" height=\"663\" src=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/BCSM-Events.png\" alt=\"\" class=\"wp-image-7127\" srcset=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/BCSM-Events.png 989w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/BCSM-Events-300x201.png 300w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/BCSM-Events-768x515.png 768w\" sizes=\"auto, (max-width: 989px) 100vw, 989px\" \/><figcaption class=\"wp-element-caption\">List of BCSM states for events<\/figcaption><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Basic MO Call with CAMEL<\/h2>\n\n\n\n<p>Our subscriber makes an outbound call. <\/p>\n\n\n\n<p>Based on the data the MSC has in it from the HLR, it knows that we should use CAMEL for this call, and it has the <a href=\"https:\/\/nickvsnetworking.com\/all-about-global-title-translation-sccp-routing\/\" data-type=\"post\" data-id=\"6836\">SCCP Address of the OCS (gsmSCF)<\/a> it needs to send the CAMEL messages to.<\/p>\n\n\n\n<p>So the MSC sends an <code>InitialDP<\/code> message to the OCS (via it&#8217;s Global Title Address) to Authorize the call that the user is trying to make.<\/p>\n\n\n\n<p>This is like any other Authorization step for an OCS, which allows the OCS to authorize the call by checking the subscriber is valid, check if they&#8217;re allowed to call that destination and they&#8217;ve got the balance to do so, etc.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"700\" src=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/invoke-IntiailDP-1024x700.png\" alt=\"\" class=\"wp-image-7125\" srcset=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/invoke-IntiailDP-1024x700.png 1024w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/invoke-IntiailDP-300x205.png 300w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/invoke-IntiailDP-768x525.png 768w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/invoke-IntiailDP.png 1281w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">initialDP message from an MSC to an OCS<\/figcaption><\/figure>\n\n\n\n<p>The <code>initialDP<\/code> (Initial Detection Point) is telling our OCS all about the call event that&#8217;s being requested, who&#8217;s calling, what number they&#8217;ve dialed, where they are in the network (<a href=\"https:\/\/nickvsnetworking.com\/how-do-you-know-if-theyre-roaming-charging-challenges-in-ims-for-roamers\/\" data-type=\"post\" data-id=\"6306\">of note especially if they&#8217;re roaming<\/a>), etc, etc.<\/p>\n\n\n\n<p>The OCS runs through it&#8217;s own checks to see if it wants to allow the call to proceed by checking <a href=\"https:\/\/nickvsnetworking.com\/jaffa-cakes-explain-the-difference-between-centralized-vs-decentralized-online-charging-in-3gpp-networks\/\" data-type=\"post\" data-id=\"4092\"> if the subscriber has got enough balance, unit reservation, etc, etc, <\/a>and if it does, the OCS sends back a <code>Continue<\/code> message to the MSC to allow the call to continue.<\/p>\n\n\n\n<p>Generally the OCS also uses this message as a chance to subscribe to BCSM Events using <code>RequestReportBCSMEventArg<\/code> so the OCS will get notified by the MSC when the state of the call changes. This means the MSC will tell us when the state of the call changes; events like the call getting answered, disconnected, etc. This is critical so we know when the call gets answered and hung-up, so we can charge correctly.<\/p>\n\n\n\n<p>In the below example, as well as sending the <code>Continue<\/code> and <code>RequestReportBCSMEventArg<\/code> the OCS is also setting the <code>ChargingArgs<\/code> for this call, so the MSC knows who to charge (the caller) set via  <code>sendingSide<\/code> and that the MSC must send an <code>Apply Charging Report<\/code> (ACR) messages every 300 units (1 unit = 100 ms, so a value of 300 = 300 x 100 milliseconds = 30 seconds) so the OCS keeps track of what&#8217;s going on.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"869\" height=\"1024\" src=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-03-09-58-27-869x1024.png\" alt=\"\" class=\"wp-image-7124\" srcset=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-03-09-58-27-869x1024.png 869w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-03-09-58-27-255x300.png 255w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-03-09-58-27-768x905.png 768w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-03-09-58-27.png 1075w\" sizes=\"auto, (max-width: 869px) 100vw, 869px\" \/><figcaption class=\"wp-element-caption\"><code>continue<\/code> sent by the OCS to the MSC, also including <code>reportBCSMEvent<\/code> and <code>applyCharging<\/code> messages<\/figcaption><\/figure>\n\n\n\n<p>At this point the call can start to proceed &#8211; In <a href=\"https:\/\/nickvsnetworking.com\/demystifying-ss7-sigtran-part-6-calling-with-isup\/\" data-type=\"post\" data-id=\"4502\">ISUP terms the <code>InitialDP<\/code> is triggered between the Initial Address Message and the Address Complete message is sent after the <code>continue<\/code> is sent back<\/a>. <\/p>\n\n\n\n<p class=\"has-small-font-size\">Or in a slightly less appropriate analogy but easier to understand for SIP folks, the InitialDP is sent for INVITE and the 180 RINGING is sent once the <code>continue<\/code> message is received. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Call is Answered<\/h2>\n\n\n\n<p>So at this stage our call can start to ring.<\/p>\n\n\n\n<p>As we&#8217;ve subscribed to BCSM events in our last message, the MSC is going to tell us when the call gets answered or the call times out, is abandoned or the sun burns out.<\/p>\n\n\n\n<p>The MSC provides this info a <code>eventReportBCSM<\/code>, which is very simple and just tells us the event that&#8217;s been triggered, in the example below, the call was answered.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"620\" height=\"313\" src=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/CAML-Call-Answered.png\" alt=\"\" class=\"wp-image-7126\" srcset=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/CAML-Call-Answered.png 620w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/CAML-Call-Answered-300x151.png 300w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><figcaption class=\"wp-element-caption\"><code>eventReportBCSM<\/code> from MSC to OCS<\/figcaption><\/figure>\n\n\n\n<p>These <code>eventReportBCSM<\/code> are informational from the MSC to the OCS, so the OCS doesn&#8217;t need to send anything back, but the OCS does need to mark the call as answered so it can start timing the call.<\/p>\n\n\n\n<p>At this stage, the call is connected and our two parties are talking, but our MSC has been told it needs to send us <code>applyChargingReport<\/code>s every 30 seconds (due to the value of 300 in <code>maxCallPeriodDuration<\/code>) after the call was connected, so the MSC sends the OCS it&#8217;s first <code>applyChargingReport<\/code> 30 seconds after the call was answered:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"339\" src=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/applyChargingReport.png\" alt=\"\" class=\"wp-image-7128\" srcset=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/applyChargingReport.png 738w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/applyChargingReport-300x138.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><figcaption class=\"wp-element-caption\">applyChargingReport sent by the MSC to the OCS every reporting period<\/figcaption><\/figure>\n\n\n\n<p>We can calculate the duration of the call so far based on the time of the <code>eventReportBCSM<\/code>, then the OCS must make a decision of if it should allow the call to continue or not.<\/p>\n\n\n\n<p>For simplicity&#8217;s sake, let&#8217;s imagine we&#8217;re still got a balance in the OCS and the OCS wants the call to continue, the OCS send back an <code>applyCharging<\/code> message to the MSC in response, and includes the current allowed <code>maxCallPeriodDuration<\/code>, keeping in mind the value is x100 and in nanoseconds (so this is 30 seconds).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"339\" src=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/applyCharging.png\" alt=\"\" class=\"wp-image-7129\" srcset=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/applyCharging.png 738w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/applyCharging-300x138.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><figcaption class=\"wp-element-caption\"><code>applyCharging<\/code> from the OCS back to the MSC<\/figcaption><\/figure>\n\n\n\n<p>Perfect, our call is good to go for another 30 more seconds, son in 30 seconds we&#8217;ll get another <code>ACR<\/code> messages from MSC to the OCS to keep it abreast of what&#8217;s going on.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Now one of two things is going to happen, either subscriber is going to burn through all of their minutes, and get their call cutoff, or the call will end while they&#8217;ve still got balance, let&#8217;s look at both scenarios.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Normal Hangup Scenario<\/h2>\n\n\n\n<p>When the call ends, we get an <code>applyChargingReport<\/code> from the MSC to the OCS.<\/p>\n\n\n\n<p>As we&#8217;ve subscribed to <code>reportBCSMEvent<\/code> we get both the <code>applyChargingReport<\/code> with <code>legActive: <\/code>False` so we know the call has hungup, and we&#8217;ve got an event report to tell us more about the event, in this case a hangup from the Originating Side.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"941\" height=\"749\" src=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/applyChargingReport-eventReportBCSM.png\" alt=\"\" class=\"wp-image-7133\" srcset=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/applyChargingReport-eventReportBCSM.png 941w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/applyChargingReport-eventReportBCSM-300x239.png 300w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/applyChargingReport-eventReportBCSM-768x611.png 768w\" sizes=\"auto, (max-width: 941px) 100vw, 941px\" \/><figcaption class=\"wp-element-caption\"><code>reportBCSMEvent<\/code> and <code>applyChargingReport<\/code> Sent by the MSC to the OCS to indicate the call has ended, note the <code>legActive<\/code> flag is now false<\/figcaption><\/figure>\n\n\n\n<p>Lastly the OCS confirms by sending a <code>releaseCall<\/code> to the MSC, to indicate all legs should now terminate.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"877\" height=\"262\" src=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/releaseCall.png\" alt=\"\" class=\"wp-image-7134\" srcset=\"https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/releaseCall.png 877w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/releaseCall-300x90.png 300w, https:\/\/nickvsnetworking.com\/wp-content\/uploads\/2024\/12\/releaseCall-768x229.png 768w\" sizes=\"auto, (max-width: 877px) 100vw, 877px\" \/><figcaption class=\"wp-element-caption\"><code>releaseCall<\/code> Sent by OCS to MSC at the very end<\/figcaption><\/figure>\n\n\n\n<p>So that&#8217;s it!<\/p>\n\n\n\n<p>Obviously there are other flows, such as running out of balance mid-call, rejecting a call, SMS and PBX \/ VPN services that rely on CAMEL, but hopefully you now understand the basics of how CAMEL based charging looks and works.<\/p>\n\n\n\n<p>If you&#8217;re looking for a CAMEL capable OCS or a CAMEL to Diameter or API gateway, get in touch!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A look at how CAMEL is used in Online Charging for 2G\/3G networks and while roaming<\/p>\n","protected":false},"author":1,"featured_media":7125,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[350,349,161,22],"tags":[689,524,346,682,523,601,544],"class_list":["post-7092","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-gsm","category-plmn","category-notes","category-standards","tag-camel","tag-charging","tag-gsm","tag-map","tag-ocs","tag-roaming","tag-ss7"],"_links":{"self":[{"href":"https:\/\/nickvsnetworking.com\/wp-json\/wp\/v2\/posts\/7092","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nickvsnetworking.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nickvsnetworking.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nickvsnetworking.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nickvsnetworking.com\/wp-json\/wp\/v2\/comments?post=7092"}],"version-history":[{"count":8,"href":"https:\/\/nickvsnetworking.com\/wp-json\/wp\/v2\/posts\/7092\/revisions"}],"predecessor-version":[{"id":7445,"href":"https:\/\/nickvsnetworking.com\/wp-json\/wp\/v2\/posts\/7092\/revisions\/7445"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nickvsnetworking.com\/wp-json\/wp\/v2\/media\/7125"}],"wp:attachment":[{"href":"https:\/\/nickvsnetworking.com\/wp-json\/wp\/v2\/media?parent=7092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nickvsnetworking.com\/wp-json\/wp\/v2\/categories?post=7092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nickvsnetworking.com\/wp-json\/wp\/v2\/tags?post=7092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}