hi,
thanks for new nice project https://ce.opensips.org/opensips-ims
we well try to use it in student/home lab

do you think it is possible use python bindings of pjsip to emulate 5G
part? (IMS client)

something like

---
import pjsua as pj

# Define Account Callback for IMS
class IMSAccountCallback(pj.AccountCallback):
    def on_credentials_request(self, realm, username, auth_hdr, allow_new):
        if realm == "ims.example.com":
            return pj.AuthCredInfo(
                scheme="Digest",
                realm=realm,
                username="alice",
                data="password123",
                data_type=pj.AUTH_CRED_DATA_PLAIN_PASSWD
            )

# Define Call Callback
class CallCallback(pj.CallCallback):
    def on_state(self):
        print("Call is ", self.call.info().state_text)

# Initialize PJSUA
lib = pj.Lib()
lib.init()
transport = lib.create_transport(pj.TransportType.UDP,
pj.TransportConfig(5060))
lib.start()

# Account Configuration
acc_cfg = pj.AccountConfig()
acc_cfg.id = "sip:[email protected]"
acc_cfg.reg_uri = "sip:ims.example.com"
acc_cfg.proxy = ["sip:pcscf.ims.example.com;lr"]
acc_cfg.allow_contact_rewrite = False

# Add Headers
msg_data = pj.MsgData()
msg_data.add_header("P-Preferred-Identity", "<sip:[email protected]>")
msg_data.add_header("Supported", "path, outbound, 100rel")
msg_data.add_header("User-Agent", "PJSIP/2.12 IMS Client")
msg_data.add_header(
    "Contact",
    '<sip:[email protected]
;transport=udp>;+sip.instance="<urn:uuid:abc123>";+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel"'
)

# Create Account
acc = lib.create_account(acc_cfg, cb=IMSAccountCallback())

# Register and Make Call
acc.set_registration(True, msg_data=msg_data)
call = acc.make_call("sip:[email protected]", cb=CallCallback(),
msg_data=msg_data)

# Wait for user input to terminate
input("Press Enter to quit...")
lib.destroy()
---

Marek
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to