<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>hi,</div><div>thanks for new nice project <a href="https://ce.opensips.org/opensips-ims" target="_blank">https://ce.opensips.org/opensips-ims</a> </div><div>we well try to use it in student/home lab</div><div><br></div><div>do you think it is possible use python bindings of pjsip to emulate 5G part? (IMS client)</div><div><br></div><div>something like<br><br></div><div>---<br>import pjsua as pj<br><br># Define Account Callback for IMS<br>class IMSAccountCallback(pj.AccountCallback):<br> def on_credentials_request(self, realm, username, auth_hdr, allow_new):<br> if realm == "<a href="http://ims.example.com">ims.example.com</a>":<br> return pj.AuthCredInfo(<br> scheme="Digest",<br> realm=realm,<br> username="alice",<br> data="password123",<br> data_type=pj.AUTH_CRED_DATA_PLAIN_PASSWD<br> )<br><br># Define Call Callback<br>class CallCallback(pj.CallCallback):<br> def on_state(self):<br> print("Call is ", <a href="http://self.call.info">self.call.info</a>().state_text)<br><br># Initialize PJSUA<br>lib = pj.Lib()<br>lib.init()<br>transport = lib.create_transport(pj.TransportType.UDP, pj.TransportConfig(5060))<br>lib.start()<br><br># Account Configuration<br>acc_cfg = pj.AccountConfig()<br><a href="http://acc_cfg.id">acc_cfg.id</a> = "<a href="mailto:sip%3Aalice@ims.example.com">sip:alice@ims.example.com</a>"<br>acc_cfg.reg_uri = "sip:<a href="http://ims.example.com">ims.example.com</a>"<br>acc_cfg.proxy = ["sip:<a href="http://pcscf.ims.example.com">pcscf.ims.example.com</a>;lr"]<br>acc_cfg.allow_contact_rewrite = False<br><br># Add Headers<br>msg_data = pj.MsgData()<br>msg_data.add_header("P-Preferred-Identity", "<<a href="mailto:sip%3Aalice@ims.example.com">sip:alice@ims.example.com</a>>")<br>msg_data.add_header("Supported", "path, outbound, 100rel")<br>msg_data.add_header("User-Agent", "PJSIP/2.12 IMS Client")<br>msg_data.add_header(<br> "Contact",<br> '<<a href="mailto:sip%3Aalice@192.0.2.1">sip:alice@192.0.2.1</a>;transport=udp>;+sip.instance="<urn:uuid:abc123>";+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel"'<br>)<br><br># Create Account<br>acc = lib.create_account(acc_cfg, cb=IMSAccountCallback())<br><br># Register and Make Call<br>acc.set_registration(True, msg_data=msg_data)<br>call = acc.make_call("<a href="mailto:sip%3Abob@ims.example.com">sip:bob@ims.example.com</a>", cb=CallCallback(), msg_data=msg_data)<br><br># Wait for user input to terminate<br>input("Press Enter to quit...")<br>lib.destroy()</div><div>---</div><div><br></div><div>Marek</div></div>
</div>
</div>