linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] Python


From: Pablo Hernán Mailluquet
Subject: [Linphone-developers] Python
Date: Sat, 3 Oct 2015 16:42:25 -0300

I need some example of a example python script to do the following:

1. Register in a SIP server
2. Make an outgoing call to SIP contact
3. Close the connection.

I 've tried the following code, but failed :

import linphone
import logging
import sys
from PyQt4.QtCore import QTimer
from PyQt4.QtGui import QApplication

def main():
    logging.basicConfig(level=logging.INFO)

    app = QApplication(sys.argv)

    def log_handler(level, msg):
        method = getattr(logging, level)
        method(msg)

    def global_state_changed(*args, **kwargs):
        logging.warning("global_state_changed: %r %r" % (args, kwargs))

    def registration_state_changed(core, call, state, message):
        logging.warning("registration_state_changed: " + str(state) + ", " + message)

    callbacks = {
        'global_state_changed': global_state_changed,
        'registration_state_changed': registration_state_changed,
    }

    linphone.set_log_handler(log_handler)
    core = linphone.Core.new(callbacks, None, None)
    ai = linphone.AuthInfo.new(None, None, None, None, None, None)
    ai.username = '101'
    ai.passwd = 'passw0rd'
    ai.domain = '192.168.88.160'
    core.add_auth_info(ai)
    core.iterate
    call = core.invite('sip:address@hidden')


main()

=============================



reply via email to

[Prev in Thread] Current Thread [Next in Thread]