#
# globals: getHeader(String headers, String name)
#             get header with name from headers
#
#          getSessionParam(String headers, String name)
#            get session parameter with name from headers
#            (parameter from P-Iptel-Param)
#
#          log(String str)
#              log using sems' log facility
#
#          createThread(Callable thread)
#              create a thread
#
#          sendMessage(destination, message)
#              send an event message
#
#    Monitoring interface
#
#           monitorLog(callid, property, value) 
#               Log a line in the monitoring log
#
#           monitorLogAdd(callid, property, value)i
#               Add a line in the monitoring log
#
#           monitorFinish(callid)
#               Mark the session finished in the monitoring log




class IvrDialogBase:

    # Event handlers
    def onStart(self): # SIP dialog start
        pass

    def onBye(self): # SIP dialog is BYEd
        pass
    
    def onSessionStart(self): # audio session start
        pass

    def onEmptyQueue(self): # audio queue is empty
        pass
    
    def onAudioCleared(self): # audio input & output have been cleared
        pass
    
    def onDtmf(self,key,duration): # received DTMF
        pass

    def onTimer(self, id): # a timer has fired
        pass

    def onIvrMessage(self, message): # a message has arrived from another session
        pass

    def onUser1(self): # SIGUSR1 signal received from the OS
        pass
    
    def onUser2(self): # SIGUSR2 signal received from the OS
        pass
    
    def onServerShutdown(self): # SEMS is shutting down
        pass
    
    # Session control
    def stopSession(self): # stop everything
        pass

    def bye(self [, headers]): # BYEs (or CANCELs) the SIP dialog
        pass

    def sendRequest(self, method, headers): # Send a SIP request
        pass

    def sendReply(self, code, reason, headers): # Send a SIP reply to the last received request
        pass


    # Media control
    def enqueue(self,audio_play,audio_rec): # add something to the playlist
        pass

    def flush(self): # flushes playlist
        pass

    # Call datas / control

    # get only property wrapping AmSipDialog AmSession::dlg.
    # only its properties should be exposed.
    dialog

    # B2BUA

    # if true, traffic will be relayed
    # transaprently to the other side
    # if this is 'True' at the beginning 
    # of the session, the Caller's INVITE
    # will be relayed to the callee, without
    # having to use connectCallee()
    B2BMode = False

    # call given party as (new) callee
    # if remote_party and remote_uri are empty (None),
    # we will connect to the callee of the initial caller request
    def connectCallee(self,remote_party,remote_uri):
        pass

    # terminate the callee's call
    def terminateOtherLeg(self):
        pass

    # terminate our call
    def terminateLeg(self):
        pass

    # start a new audio session with the caller
    # sends a re-INVITE if needed.
    def connectAudio(self):
        pass

    # end the audio session
    # sends a re-INVITE if needed to reconnect to the current callee
    def disconnectAudio(self):
    	pass

    # B2BUA Event handlers
    # some other handlers...
