Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Realm is used to determine the direction of the call. The system uses the Source realm and the Delivered To realm to determine the direction of the call. The systems ability to determine a calls direction is important when determining whether a call should be recorded for an Account as well as for general reporting purposes. It should be noted that superficially it would appear to be quite easy to determine a calls direction however in practices it can be quite complicated as a call can actually changed direction mid way through the call.

Target

A Target can be a phone no., a pattern or an alphabetical literal.
A Target pattern is a used to match Targets consisting of digits only.

SourceNo

Set by core routing each time a call is originated. For inbound this is the caller id, for calls dialed from a handset this is the handset extension no.

- The source no. can be changed but should only be done to cleanup the caller id from a sip provider that presents it badly. This should be done via the rewrite-source action.

setDeliveredTo - dial/queue/voicemail/conference no does this

- remove from api as will be moved to Dial.

Used to set the realm and number the call is finally delivered to.

- Called each time 'gosub' is invoked to update the realm and routing number

DialedNo

- called by the core routing logic when a call first enters the system. Normally this wouldn't be modified by a script unless the trunk provider provides a badly formatted no. hin which you may want to re-reformat it using the rewrite action.

For most systems the dialed no. doesn't change during the life of a call.

setRoutedNo(number)

- should we rename to setRoutedTarget(context, target)

...

The routed no is essentially updated each time the call transition into a new call route.

 


The BaseScriptRoute class exposes the following methods.

Overview:

MethodArgumentsReturn typeComments
actionAccountRecordingVoidVoidStart recording if the agent(s) involved in the call are flagged for recording
dialTrunk trunk, String phoneNo, String options, int timeoutvoid

Dials the given phone number using the selected trunk.

trunk - the trunk to dial over

phoneNo - the phone number to dial

options - any asterisk dial options required.

timeout - the time (in seconds) to wait for the dial to connect.

conferenceString roomNo, String pin, String options
 

roomNo - The conference room to pass the call to. If the conference room doesn't exist it will be dynamically created.

PIN - the pin number used to control access to the conference room. Pass a blank string if you don't want a PIN assigned to the conference room.

options - any valid asterisk conference room options.

getAccountFromIdLong idAccountLook up an account using the id passed in. The Account object returned is detached from the database.
getAgivoidBaseAgiScriptReturns the BaseAgiScript, this allows direct agi calls to be made against the channel
getArgAsBooleanString fieldNameBooleanTakes a fieldName for the Script and returns the fields value as a Boolean.
getArgAsIntString fieldNameIntegerTakes a fieldName for the Script and returns the fields value as an Integer.
getArgAsLongString fieldNameLongTakes a fieldName for the Script and returns the fields value as a Long.
getArgAsStringString fieldNameStringTakes a fieldName for the Script and returns the fields value as a String.
getBMMFileNameFromIdLong idStringReturns the name of the BMM audio file without the file extension. This is suitable for passing to the 'playback' command which assumes the file doesn't has a file extensions.
getChannelVariableString nameStringGets the value of an Asterisk channel variable.
getDialedNoVoidStringReturns the number that was dialed to trigger this call route. For inbound calls this will be the DID, for outbound calls it will by the number dialed from the handsets.
getDirectionVoidau.com.noojee.callrouting.CallDirection

Returns the CallDirection enum indicating which direction the call is flowing in. CallDirection has the following possible values:

CallDirection.INBOUND

CallDirection.PASS_THRU - not used on most systems

CallDirection.INBOUND

getHandsetFromIdLong idHandset

Looks up the Handset indentified by id and returns a detached entity

getPhoneNoForAccountIdLong idStringReturns the phone currently attached to the given account.
getQueueFromIdLong idQueueLooks up the Queue indentified by id and returns a detached entity
getRoutedNoNoneStringThe current RoutedNo. See setRoutedNo() for details.
getSourceNoNoneStringReturns the source phone no. that originated the call. For an inbound call it is the callers caller id, for an outbound call it is the handsets extension no.
getSourceRealmNoneRealmReturns the Realm for the current call. When any call enters the system a Realm is set to describe how the call entered the system. The two Realms are Realm.INTERNAL and Realm.EXTERNAL
    




getSystemVariableString keySystemEntityreturns a detatched system variable entity for the given key.
getTrunkDialStringFromIdLong idString

Returns the Dial String for the trunk whose primary key is id.

getTrunkFromIdLong idTrunkReturns the Trunk object whose primary key is id.
getVariableString nameStringGets the value of the Route Script variable with the given name. Route Script Variables have a life cycle linked to the underlying call. Route Script Variables are much faster than Channel Variables.
getVoiceMailBoxFromIdLongVoiceMailBoxreturns the VoiceMailBox entity for the given id.
gosubRouteContext context, String numbervoidSend the call to the given context with the given number as the 'deliveredTo' number.
queueQueue queue, String options, int timeoutvoid

queuename - the name of the queue to send the call to

options - any valid asterisk queue options

timeout - the amount of time to wait for the call to be connected before exiting the queue.

The deliveredTo number gets set to the Agents extension when the call is answered by an agent.

setChannelVariableString name, String valueVoidSets the value of an Asterisk channel variable.
setDialedNoString numberVoidAllows the dialedNo to be modified by a script.
setSource

String number, Realm realm

VoidSet the number the call came from and the realm (INTERNAL/EXTERNAL ETC)
setVariableString name, String valueVoidSets the value of the Route Script variable with the given name creating it if it doesn't already exists.
 substituteVariablesString messageStringParses the passed message looking for any encoded Route variable names and replacing the encode variable name with the variables value. The encoding scheme is of the form: ${variablename}
startRecordingVoidVoidUnconditionally starts recording the current call. If recording is already running then a new leg is started.
stopRecordingVoidVoidStops recording.
voicemailString vmbox, String optionsvoid

Connects the caller to the given voicemail box.

vmbox - the voicemail box no.

options - any valid asterisk voicemail box options.

variableExistsString nameBooleanreturns true if the variable with the given name exists and is non-zero in length.
  
  




Variables:

Call Routes provide a number of default variables which can be access to determine information pertaining to the current call or the system as a whole. The following variables can be access by calling getVariableValue(variableName) on the Api.

Variable NameDescriptionScope
dialedNo

The number that was dialed to cause the current call. For an inbound call this will be the DID for an outbound call this will be the no. dialed from the staff members handset.

You should be aware that this value can be modified by calling setDialedNo

Call