I'm working on creating a SIP client using Python and PJSUA2. I'm testing it with a SIP server running on the same host. When I call makeCall() Wireshark shows the following:
- The INVITE message is being sent to the server
- The server responding back with 180 - Ringing
- The server responding back with 200 - OK
My client never ACKs the 200-OK message. Should this be done automatically or is there something I need to configure to get it to ACK? I suspect that I am not setting up a callback correctly, but am not sure.
import time
import pjsua2 as pj
class MyCall(pj.Call):
def onCallState(self, prm):
print("***OnCallState: ")
call_info = self.getInfo()
print("current state is " + str(call_info.state) + " " + call_info.stateText)
print("last status code: " + str(call_info.lastStatusCode))
ep = pj.Endpoint()
ep_cfg = pj.EpConfig()
ep_cfg.uaConfig.threadCnt = 0
ep.libCreate()
ep.libInit(ep_cfg)
sipTpConfig = pj.TransportConfig()
ep.transportCreate(pj.PJSIP_TRANSPORT_UDP, sipTpConfig)
ep.libStart()
# Create the account information
acfg = pj.AccountConfig()
acfg.idUri = "sip:test@xxxxxxxxx";
acfg.regConfig.registrarUri = "sip:pjsip.org";
cred = pj.AuthCredInfo("digest", "*", "test", 0, "pwtest");
acfg.sipConfig.authCreds.append( cred );
acc = pj.Account()
acc.create(acfg)
call = MyCall(acc, pj.PJSUA_INVALID_ID)
prm = pj.CallOpParam(True)
call.makeCall("sip:service@127.0.0.1", prm)
time.sleep(5)
ep.libDestroy()
del ep
|
_______________________________________________
Visit our blog: http://blog.pjsip.org
pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org