AOCMessage

Since 1.8.0 AMI Actions Found this useful? Upvote it. ×

Generate an Advice of Charge message on a channel.

Last reviewed 2026-04-14

AOCMessage
Description

Generates an AOC-S, AOC-D or AOC-E message on a channel.

Arguments
  • ActionID - ActionID for this transaction. Will be returned.
  • Channel - Channel name to generate the AOC message on. This value is required unless ChannelPrefix is given.
  • ChannelPrefix - Partial channel prefix. By using this option one can match the beginning part of a channel name without having to put the entire name in. For example if a channel name is SIP/snom-00000001 and this value is set to SIP/snom, then that channel matches and the message will be sent. Note however that only the first matched channel has the message sent on it.
  • MsgType required - Defines what type of AOC message to create, AOC-S, AOC-D or AOC-E
    • S
    • D
    • E
  • ChargeType - Defines what kind of charge this message represents for AOC-D and AOC-E.
    • NA
    • FREE
    • Currency
    • Unit
  • UnitAmount(0) - This represents the amount of units charged. The ETSI AOC standard specifies that this value along with the optional UnitType value are entries in a list. To accommodate this these values take an index value starting at 0 which can be used to generate this list of unit entries. For example, If two unit entries were required this could be achieved by setting the parameter UnitAmount(0)=1234 and UnitAmount(1)=5678. Note that UnitAmount at index 0 is required when ChargeType=Unit, all other entries in the list are optional.
  • UnitType(0) - Defines the type of unit. ETSI AOC standard specifies this as an integer value between 1 and 16, but this value is left open to accept any positive integer. Like the UnitAmount parameter, this value represents a list entry and has an index parameter that starts at 0.
  • CurrencyName - Specifies the currency's name. Note that this value is truncated after 10 characters.
  • CurrencyAmount - Specifies the charge unit amount as a positive integer. This value is required when ChargeType==Currency (AOC-D or AOC-E) or RateType==Duration/Flat/Volume (AOC-S).
  • CurrencyMultiplier - Specifies the currency multiplier. This value is required when CurrencyAmount is given.
    • OneThousandth
    • OneHundredth
    • OneTenth
    • One
    • Ten
    • Hundred
    • Thousand
  • TotalType - Defines what kind of AOC-D total is represented.
    • Total
    • SubTotal
  • AOCBillingId - Represents a billing ID associated with an AOC-D or AOC-E message. Note that only the first 3 items of the enum are valid AOC-D billing IDs
    • Normal
    • ReverseCharge
    • CreditCard
    • CallFwdUnconditional
    • CallFwdBusy
    • CallFwdNoReply
    • CallDeflection
    • CallTransfer
  • ChargingAssociationId - Charging association identifier. This is optional for AOC-E and can be set to any value between -32768 and 32767
  • ChargingAssociationNumber - Represents the charging association party number. This value is optional for AOC-E.
  • ChargingAssociationPlan - Integer representing the charging plan associated with the ChargingAssociationNumber. The value is bits 7 through 1 of the Q.931 octet containing the type-of-number and numbering-plan-identification fields.
  • ChargedItem - Defines what part of the call is charged in AOC-S. Usually this is set to BasicCommunication, which refers to the time after the call is answered, but establishment (CallAttempt) or successful establishment (CallSetup) of a call can also be used. Other options are available, but these generally do not carry enough information to actually calculate the price of a call. It is possible to have multiple ChargedItem entries for a single call -- for example to charge for both the establishment of the call and the actual call. In this case, each ChargedItem is described by a ChargedItem: header and all other headers that follow it up to the next ChargedItem: header.
    • NA
    • SpecialArrangement
    • BasicCommunication
    • CallAttempt
    • CallSetup
    • UserUserInfo
    • SupplementaryService
  • RateType - Defines how an AOC-S ChargedItem is charged. The Duration option is only available when ChargedItem==BasicCommunication.
    • NA
    • Free
    • FreeFromBeginning
    • Duration
    • Flat
    • Volume
    • SpecialCode
  • Time - Specifies a positive integer which is the amount of time is paid for by one CurrencyAmount. This value is required when RateType==Duration.
  • TimeScale - Specifies the time multiplier. This value is required when Time is given.
    • OneHundredthSecond
    • OneTenthSecond
    • Second
    • TenSeconds
    • Minute
    • Hour
    • Day
  • Granularity - Specifies a positive integer which is the size of the charged time increments. This value is optional when RateType==Duration and ChargingType==StepFunction.
  • GranularityTimeScale - Specifies the granularity time multiplier. This value is required when Granularity is given.
    • OneHundredthSecond
    • OneTenthSecond
    • Second
    • TenSeconds
    • Minute
    • Hour
    • Day
  • ChargingType - Specifies whether the charge increases continuously with time or in increments of Time or, if provided, Granularity. This value is required when RateType==Duration.
    • ContinuousCharging
    • StepFunction
  • VolumeUnit - Specifies the quantity of which one unit is paid for by one CurrencyAmount. This value is required when RateType==Volume.
    • Octet
    • Segment
    • Message
  • Code - Specifies the charging code, which can be set to a value between 1 and 10. This value is required when ChargedItem==SpecialArrangement or RateType==SpecialCode.

User Notes

No notes yet. Be the first to contribute a tip or example.

Contribute a note

Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.

Moderated before publishing. Email never shown.
AMI Actions
Command AGI AOCMessage AbsoluteTimeout AgentLogoff Agents Atxfer BlindTransfer Bridge BridgeDestroy BridgeInfo BridgeKick BridgeList BridgeTechnologyList BridgeTechnologySuspend BridgeTechnologyUnsuspend CancelAtxfer Challenge ChangeMonitor ConfbridgeKick ConfbridgeList ConfbridgeListRooms ConfbridgeLock ConfbridgeMute ConfbridgeSetSingleVideoSrc ConfbridgeStartRecord ConfbridgeStopRecord ConfbridgeUnlock ConfbridgeUnmute ControlPlayback CoreSettings CoreShowChannelMap CoreShowChannels CoreStatus CreateConfig DAHDIDNDoff DAHDIDNDon DAHDIDialOffhook DAHDIHangup DAHDIRestart DAHDIShowChannels DAHDIShowStatus DAHDITransfer DBDel DBDelTree DBGet DBGetTree DBPut DeviceStateList DialplanExtensionAdd DialplanExtensionRemove Events ExtensionState ExtensionStateList FAXSession FAXSessions FAXStats Filter GetConfig GetConfigJSON Getvar Hangup IAXnetstats IAXpeerlist IAXpeers IAXregistry JabberSend ListCategories ListCommands LocalOptimizeAway LoggerRotate Login Logoff MWIDelete MWIGet MWIUpdate MailboxCount MailboxStatus MeetmeList MeetmeListRooms MeetmeMute MeetmeUnmute MessageSend MixMonitor MixMonitorMute ModuleCheck ModuleLoad Monitor MuteAudio Originate PJSIPHangup PJSIPNotify PJSIPQualify PJSIPRegister PJSIPShowAors PJSIPShowAuths PJSIPShowContacts PJSIPShowEndpoint PJSIPShowEndpoints PJSIPShowRegistrationInboundContactStatuses PJSIPShowRegistrationsInbound PJSIPShowRegistrationsOutbound PJSIPShowResourceLists PJSIPShowSubscriptionsInbound PJSIPShowSubscriptionsOutbound PJSIPUnregister PRIDebugFileSet PRIDebugFileUnset PRIDebugSet PRIShowSpans Park ParkedCalls Parkinglots PauseMonitor Ping PlayDTMF PlayMF PresenceState PresenceStateList QueueAdd QueueChangePriorityCaller QueueLog QueueMemberRingInUse QueuePause QueuePenalty QueueReload QueueRemove QueueReset QueueRule QueueStatus QueueSummary QueueWithdrawCaller Redirect Reload SIPnotify SIPpeers SIPpeerstatus SIPqualifypeer SIPshowpeer SIPshowregistry SKINNYdevices SKINNYlines SKINNYshowdevice SKINNYshowline SendFlash SendText Setvar ShowDialPlan SorceryMemoryCacheExpire SorceryMemoryCacheExpireObject SorceryMemoryCachePopulate SorceryMemoryCacheStale SorceryMemoryCacheStaleObject Status StopMixMonitor StopMonitor UnpauseMonitor UpdateConfig UserEvent VoicemailBoxSummary VoicemailForward VoicemailMove VoicemailRefresh VoicemailRemove VoicemailUserStatus VoicemailUsersList WaitEvent
AMI Actions
Command AGI AOCMessage AbsoluteTimeout AgentLogoff Agents Atxfer BlindTransfer Bridge BridgeDestroy BridgeInfo BridgeKick BridgeList BridgeTechnologyList BridgeTechnologySuspend BridgeTechnologyUnsuspend CancelAtxfer Challenge ChangeMonitor ConfbridgeKick ConfbridgeList ConfbridgeListRooms ConfbridgeLock ConfbridgeMute ConfbridgeSetSingleVideoSrc ConfbridgeStartRecord ConfbridgeStopRecord ConfbridgeUnlock ConfbridgeUnmute ControlPlayback CoreSettings CoreShowChannelMap CoreShowChannels CoreStatus CreateConfig DAHDIDNDoff DAHDIDNDon DAHDIDialOffhook DAHDIHangup DAHDIRestart DAHDIShowChannels DAHDIShowStatus DAHDITransfer DBDel DBDelTree DBGet DBGetTree DBPut DeviceStateList DialplanExtensionAdd DialplanExtensionRemove Events ExtensionState ExtensionStateList FAXSession FAXSessions FAXStats Filter GetConfig GetConfigJSON Getvar Hangup IAXnetstats IAXpeerlist IAXpeers IAXregistry JabberSend ListCategories ListCommands LocalOptimizeAway LoggerRotate Login Logoff MWIDelete MWIGet MWIUpdate MailboxCount MailboxStatus MeetmeList MeetmeListRooms MeetmeMute MeetmeUnmute MessageSend MixMonitor MixMonitorMute ModuleCheck ModuleLoad Monitor MuteAudio Originate PJSIPHangup PJSIPNotify PJSIPQualify PJSIPRegister PJSIPShowAors PJSIPShowAuths PJSIPShowContacts PJSIPShowEndpoint PJSIPShowEndpoints PJSIPShowRegistrationInboundContactStatuses PJSIPShowRegistrationsInbound PJSIPShowRegistrationsOutbound PJSIPShowResourceLists PJSIPShowSubscriptionsInbound PJSIPShowSubscriptionsOutbound PJSIPUnregister PRIDebugFileSet PRIDebugFileUnset PRIDebugSet PRIShowSpans Park ParkedCalls Parkinglots PauseMonitor Ping PlayDTMF PlayMF PresenceState PresenceStateList QueueAdd QueueChangePriorityCaller QueueLog QueueMemberRingInUse QueuePause QueuePenalty QueueReload QueueRemove QueueReset QueueRule QueueStatus QueueSummary QueueWithdrawCaller Redirect Reload SIPnotify SIPpeers SIPpeerstatus SIPqualifypeer SIPshowpeer SIPshowregistry SKINNYdevices SKINNYlines SKINNYshowdevice SKINNYshowline SendFlash SendText Setvar ShowDialPlan SorceryMemoryCacheExpire SorceryMemoryCacheExpireObject SorceryMemoryCachePopulate SorceryMemoryCacheStale SorceryMemoryCacheStaleObject Status StopMixMonitor StopMonitor UnpauseMonitor UpdateConfig UserEvent VoicemailBoxSummary VoicemailForward VoicemailMove VoicemailRefresh VoicemailRemove VoicemailUserStatus VoicemailUsersList WaitEvent