示例#1
0
 def __init__(self, channel, message):
     """
     `channel` is the channel along which to send `message`.
     """
     _Request.__init__(self, "SendText")
     self['Channel'] = channel
     self['Message'] = message
示例#2
0
 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)
示例#3
0
 def __init__(self, conference, channel):
     """
     `channel` is the channel to be kicked from `conference`.
     """
     _Request.__init__(self, 'ConfbridgeKick')
     self['Conference'] = conference
     self['Channel'] = channel
示例#4
0
 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
示例#5
0
 def __init__(self, conference, channel):
     """
     `channel` is the video source in `conference`.
     """
     _Request.__init__(self, 'ConfbridgeSetSingleVideoSource')
     self['Conference'] = conference
     self['Channel'] = channel
示例#6
0
 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
示例#7
0
 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
示例#8
0
 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
示例#9
0
 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
示例#10
0
 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
示例#11
0
    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'
示例#12
0
 def __init__(self, conference, channel):
     """
     `channel` is the channel to be unmuted in `conference`.
     """
     _Request.__init__(self, 'ConfbridgeUnmute')
     self['Conference'] = conference
     self['Channel'] = channel
示例#13
0
 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
示例#14
0
 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
示例#15
0
 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
示例#16
0
 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
示例#17
0
 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
示例#18
0
 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
示例#19
0
 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
示例#20
0
 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
示例#21
0
 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))
示例#22
0
 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
示例#23
0
 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
示例#24
0
 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
示例#25
0
 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'
示例#26
0
 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
示例#27
0
 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
示例#28
0
 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
示例#29
0
    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()])
示例#30
0
 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