datso / react-native-pjsip

A PJSIP module for React Native.
http://datso.github.io/react-native-pjsip
GNU General Public License v3.0
273 stars 231 forks source link

Make sip call without registration #116

Open rcorrie opened 6 years ago

rcorrie commented 6 years ago

Hey @datso is it possible in pjsip to make a sip call without registering a sip account? I'd be happy to submit a PR if needed, but maybe you can point me to the right place for reference or documentation.

datso commented 6 years ago

Hey, try regOnAdd=false option in account configuration

rcorrie commented 6 years ago

thanks @datso Do you also know if there's a way to change the 'From' header on an individual call? Right now it uses the data from the account config (username, etc.)?

datso commented 6 years ago

Yea, use {headers: {"From": "Blablabla"}} in options of makeCall method.

rcorrie commented 6 years ago

@datso that adds a duplicate header, but it doesnt override the first one. This is what I see on the Invite (notice the double From headers):

Message Header
    Via: SIP/2.0/UDP 73.0.79.232:64447;rport;branch=z9hG4bKPj31d3ae9b-7d32-4282-853a-96fa70d514ba
    Max-Forwards: 70
    From: "n2p Tester" <sip:e41dd5357e7ed566168b543c7927e6d3@mysipserver.com>;tag=741fd6e1-707c-4a1c-92f0-675bb4f8321e
    From: 15555215554 // <----------- This *should* be the only From header
    To: sip:411@mysipserver.com
    Contact: "Tester" <sip:e41dd5357e7ed566168b543c7927e6d3@x.x.x.x:56902;ob>
    Call-ID: 199ca83e-c805-4563-af53-0b6aa852f781
    CSeq: 22616 INVITE
    Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
    Supported: replaces, 100rel, timer, norefersub
    Session-Expires: 1800
    Min-SE: 90
    User-Agent: React Native PjSip (2.7.1)
    Content-Type: application/sdp
    Content-Length:   298
datso commented 6 years ago

Yeap, in that case some changes is required to make it work.

Please check CallSettingsDTO.java, you could add there an option regarding From header. Another option is to check how to make header names unique in pjsip, may be there is some flag for that.

mdiflorio commented 6 years ago

@datso, when making a call is it possible to respond to a PJSIP_SC_PROXY_AUTHENTICATION_REQUIRED / 407, by using a Proxy-Authenticate with a nonce and realm?