def __init__(self, channel, message): """ `channel` is the channel along which to send `message`. """ _Request.__init__(self, "SendText") self['Channel'] = channel self['Message'] = message
def __init__(self, channel, digit): """ `channel` is the channel to be affected, and `digit` is the tone to play. """ _Request.__init__(self, 'PlayDTMF') self['Channel'] = channel self['Digit'] = str(digit)
def __init__(self, conference, channel): """ `channel` is the channel to be kicked from `conference`. """ _Request.__init__(self, 'ConfbridgeKick') self['Conference'] = conference self['Channel'] = channel
def __init__(self, dahdi_channel, number): """ `dahdi_channel` is the channel to use and `number` is the number to dial. """ _Request.__init__(self, 'DAHDIDialOffhook') self['DAHDIChannel'] = dahdi_channel self['Number'] = number
def __init__(self, conference, channel): """ `channel` is the video source in `conference`. """ _Request.__init__(self, 'ConfbridgeSetSingleVideoSource') self['Conference'] = conference self['Channel'] = channel
def __init__(self, channel, user_field): """ `channel` is the channel to be affected, and `user_field` is the value to set. """ _Request.__init__(self, 'SetCDRUserField') self['Channel'] = channel self['UserField'] = user_field
def __init__(self, conference, channel): """ `channel` is the channel to which MoH should be stopped in `conference`. """ _Request.__init__(self, 'ConfbridgeMoHOff') self['Conference'] = conference self['Channel'] = channel
def __init__(self, family, key): """ `family` and `key` are specifiers to select the value to retrieve. """ _Request.__init__(self, 'DBGet') self['Family'] = family self['Key'] = key
def __init__(self, conference=None): """ `conference` is the optional identifier of the bridge. """ _Request.__init__(self, 'MeetmeList') if not conference is None: self['Conference'] = conference
def __init__(self, interface, queue): """ Removes the device identified by `interface` from the given `queue`. """ _Request.__init__(self, "QueueRemove") self['Queue'] = queue self['Interface'] = interface
def __init__(self, username, secret, events=True, challenge=None, authtype=AUTHTYPE_MD5): """ `username` and `secret` are the credentials used to authenticate. `events` may be set to `False` to prevent unsolicited events from being received. This is normally not desireable, so leaving it `True` is usually a good idea. If given, `challenge` is a challenge string provided by Asterisk after sending a `Challenge` action, used with `authtype` to determine how to authenticate. `authtype` is ignored if the `challenge` parameter is unset. """ _Request.__init__(self, 'Login') self['Username'] = username if not challenge is None and authtype: self['AuthType'] = authtype if authtype == AUTHTYPE_MD5: self['Key'] = hashlib.md5(challenge + secret).hexdigest() else: raise ManagerAuthError( "Invalid AuthType specified: %(authtype)s" % { 'authtype': authtype, }) else: self['Secret'] = secret if not events: self['Events'] = 'off'
def __init__(self, conference, channel): """ `channel` is the channel to be unmuted in `conference`. """ _Request.__init__(self, 'ConfbridgeUnmute') self['Conference'] = conference self['Channel'] = channel
def __init__(self, queue=None): """ Describes all queues in the system, unless `queue` is given, which limits the scope to one. """ _Request.__init__(self, "QueueSummary") if not queue is None: self['Queue'] = queue
def __init__(self, mask): """ `Mask` is one of the following... * EVENTMASK_ALL * EVENTMASK_NONE ...or an iterable, like a tuple, with any combination of the following... * EVENTMASK_CALL * EVENTMASK_LOG * EVENTMASK_SYSTEM If an empty value is provided, EVENTMASK_NONE is assumed. """ _Request.__init__(self, 'Events') if isinstance(mask, str): self['EventMask'] = mask else: if EVENTMASK_ALL in mask: self['EventMask'] = EVENTMASK_ALL else: self['EventMask'] = ','.join( (m for m in mask if not m == EVENTMASK_NONE)) or EVENTMASK_NONE
def __init__(self, family, key=None): """ `family` and `key` (optional) are specifiers to select the values to remove. """ _Request.__init__(self, 'DBDelTree') self['Family'] = family if not key is None: self['Key'] = key
def __init__(self, channel, filename): """ `channel` is the channel to be affected and `filename` is the new target filename, without extension, as either an auto-resolved or absolute path. """ _Request.__init__(self, 'ChangeMonitor') self['Channel'] = channel self['File'] = filename
def __init__(self, **kwargs): """ Any keyword-arguments passed will be present in the generated event, making this usable as a crude form of message-passing between AMI clients. """ _Request.__init__(self, 'UserEvent') for (key, value) in kwargs.items(): self[key] = value
def __init__(self, module=None): """ If given, `module` limits the scope of the reload to a specific module, named without extension. """ _Request.__init__(self, "Reload") if not module is None: self['Module'] = module
def __init__(self, extension, context): """ `extension` is the extension to be checked and `context` is the container in which it resides. """ _Request.__init__(self, 'ExtensionState') self['Exten'] = extension self['Context'] = context
def __init__(self, family, key, value): """ `family` and `key` are specifiers for where to place `value`. """ _Request.__init__(self, 'DBPut') self['Family'] = family self['Key'] = key self['Val'] = value
def __init__(self, channel, seconds=0): """ Causes the call on `channel` to be hung up after `seconds` have elapsed, defaulting to disabling auto-hangup. """ _Request.__init__(self, 'AbsoluteTimeout') self['Channel'] = channel self['Timeout'] = str(int(seconds))
def __init__(self, conference, filename=None): """ `conference` is the room to be recorded, and `filename`, optional, is the path, Asterisk-resolved or absolute, of the file to write. """ _Request.__init__(self, 'ConfbridgeStartRecord') self['Conference'] = conference if filename: self['RecordFile'] = filename
def __init__(self, meetme, usernum): """ `meetme` is the identifier of the bridge and `usernum` is the participant ID of the user to be muted, which is associated with a channel by the 'MeetmeJoin' event. If successful, this request will trigger a 'MeetmeMute' event. """ _Request.__init__(self, 'MeetmeMute') self['Meetme'] = meetme self['Usernum'] = usernum
def __init__(self, variable, channel=None): """ `variable` is the name of the variable to retrieve. `channel` is optional; if not specified, a global variable is retrieved. """ _Request.__init__(self, 'Getvar') self['Variable'] = variable if not channel is None: self['Channel'] = channel
def __init__(self, channel_1, channel_2, tone=False): """ `channel_1` is the channel to which `channel_2` will be connected. `tone`, if `True`, will cause a sound to be played on `channel_2`. """ _Request.__init__(self, "Bridge") self['Channel1'] = channel_1 self['Channel2'] = channel_2 self['Tone'] = tone and 'yes' or 'no'
def __init__(self, interface, paused, queue=None): """ `interface` is the device to be affected, and `queue` optionally limits the scope to a single queue. `paused` must be `True` or `False`, to control the action being taken. """ _Request.__init__(self, "QueuePause") self['Interface'] = interface self['Paused'] = paused and 'true' or 'false' if not queue is None: self['Queue'] = queue
def __init__(self, interface, penalty, queue=None): """ Changes the `penalty` value associated with `interface` in all queues, unless `queue` is defined, limiting it to one. """ _Request.__init__(self, "QueuePenalty") self['Interface'] = interface self['Penalty'] = str(penalty) if not queue is None: self['Queue'] = queue
def __init__(self, file, conference, channel=None): """ `file`, resolved like other Asterisk media, is played to `conference` or, if specified, a specific `channel` therein. """ _Request.__init__(self, 'ConfbridgePlayFile') self['Conference'] = conference if channel: self['Channel'] = channel self['File'] = file
def __init__(self, channel, headers={}): """ `channel` is the channel along which to send the NOTIFY. `headers` is a dictionary of key-value pairs to be inserted as SIP headers. """ _Request.__init__(self, "SIPnotify") self['Channel'] = channel if headers: self['Variable'] = tuple(['%(key)s=%(value)s' % {'key': key, 'value': value,} for (key, value) in headers.items()])
def __init__(self, variable, value, channel=None): """ `value` is the value to be set under `variable`. `channel` is the channel to be affected, or `None`, the default, if the variable is global. """ _Request.__init__(self, 'Setvar') if channel: self['Channel'] = channel self['Variable'] = variable self['Value'] = value