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 229 forks source link

SIP/2.0 401 Unauthorized #182

Open kiritm-nimblechapps opened 5 years ago

kiritm-nimblechapps commented 5 years ago

Hi,

I have the error to create an account.

pjsua_core.c .RX 499 bytes Response msg 401/REGISTER/cseq=39923 (rdata0x11c08e228) from UDP 131.191.161.131:5060: SIP/2.0 401 Unauthorized

My Account configuration :


let configuration = {
      "name": "John1",
      "username": "0662505070",
      "domain": "131.191.161.131",
      "password": "******",
      "proxy": null,
      "transport": "UDP", // Default TCP
      "regServer": null, // Default wildcard
      "regTimeout": 3600 // Default 3600
    };

Please help me.

Thanks.

yunhanxia commented 5 years ago

I think you forgot to add the port, your domain should be look like this "131.191.161.131:5161"

kiritm-nimblechapps commented 5 years ago

I think you forgot to add the port, your domain should be look like this "131.191.161.131:5161"

I have added port inside domain like you say, I got message "Invalid Domain". I think domain is right because account is successfully created use of the domain.

yunhanxia commented 5 years ago

about your username, i don't think you can use a number from trunk, try something local, like "something#123", also make sure you configured for PJSIP

kiritm-nimblechapps commented 5 years ago

about your username, i don't think you can use a number from trunk, try something local, like "something#123", also make sure you configured for PJSIP

Can you send me full configuration you set for PJSIP.

yunhanxia commented 5 years ago

let configuration = { "name": "something#extension", "username": "something#extension", "transport": "UDP", "domain": "address:port", "password": "password" }; Did you configure PJSIP at asterisk side ?

kiritm-nimblechapps commented 5 years ago

@yunhanxia

I set as your configure but i don't create account.

PJSIP at asterisk side ? I don't know.

yunhanxia commented 5 years ago

your server I mean

kiritm-nimblechapps commented 5 years ago

okay. Can you send me server setting for it.

yunhanxia commented 5 years ago

Can you send the full code of creating account and make call ?

kiritm-nimblechapps commented 5 years ago

Can you send the full code of creating account and make call ?

I send some code.

kiritm-nimblechapps commented 5 years ago
import { Endpoint } from 'react-native-pjsip'
let endpoint = new Endpoint();

    let configuration = {
      "name": "name",
      "username": "username",
      "domain": "domain",
      "password": "password",
      "proxy": null,
      "transport": "UDP", // Default TCP
      "regServer": null, // Default wildcard
      "regTimeout": 3600 // Default 3600
    };

    endpoint.createAccount(configuration).then((account) => {
      console.log("Account created", account);
      if (account !== null) {
         let call = await endpoint.makeCall(this.state.account, +9157665544);
      }
    });

As Above code for creating Account and for make a call after successfully creating account.

yunhanxia commented 5 years ago

let options = { headers: { 'P-Asserted-Identity': 'Header Example', 'X-UA': 'React native' } }; let call = await endpoint.makeCall(account, "sip:" + number + "@" + domain, options); thats my makecall

kiritm-nimblechapps commented 5 years ago

The Header value is fixed.

'P-Asserted-Identity': 'Header Example',
'X-UA': 'React native'
kiritm-nimblechapps commented 5 years ago

I check on LinePhone App with all setting. In this app account created successfully but there is not calling inside the app.

App : https://play.google.com/store/apps/details?id=org.linphone&hl=en_IN

Can you say what's issue. and what's server side integration.

yunhanxia commented 5 years ago

I don't have access to my server's source config (asterisk), but we have an admin platform that i can update an extension on PJSIP or SIP. In my App, I did a local config with username as "something#extension" (myhome#500 for example) and domain as "myipaddress:port" (192.168.1.25:5161 for example).

For make call, my destination : "sip:" + number + "@" + domain", the number could be local and external (sip:600@192.168.1.25:5161 or sip:0612345678@192.168.1.25:5161)

itolegmysin commented 4 years ago

Hey, I've the same problem. I started the officeSIP server (windows 10) and am trying to connect to an existing user and pass following configuration:

const configuration = {
      name: "Oleg",
      username: "oleg",
      domain: '192.168.4.179:5060',
      password: "123",
      proxy: null,
    };

image

Versions: react-native: 0.59.9 react-native-pjsip: 2.7.4

Amaan630 commented 4 years ago

How did you manage to successfully install this? When I run npm i react-native-pjsip I am getting version ^2.7.4 but there is a podspec issue that prevents me from using it. 2.8.0 appears to have resolved this issue but npm is not installing 2.8.0.

marufMunshi commented 3 years ago

@Amaan630
"react-native-pjsip": "git+https://github.com/datso/react-native-pjsip.git" this will install 2.8.0

marufMunshi commented 3 years ago

Hi, @yunhanxia I am facing this issue

Title: pjsua_call_make_call(acc.getId(), &pj_dst_uri, param.p_opt, this, param.p_msg_data, &id) Code: 171039 Description: Invalid URI (PJSIP_EINVALIDURI) Location: ../src/pjsua2/call.cpp:566

Thanks in advance.

Sulbha-Mishra29 commented 2 years ago

Hi @marufMunshi I am facing the same issue, have you find out the solution ?? Thanks in advance.

marufMunshi commented 2 years ago

No, I did not find the solution, we eventually ended up using Linphone. @Sulbha-Mishra29

Sulbha-Mishra29 commented 2 years ago

Okay thanks for reply, But Linphone is only available for Android project, So have you created interface for react native application ??

On Sun, Feb 20, 2022, 12:30 PM Maruf Hasan @.***> wrote:

No, I did not find the solution, we eventually ended up using Linphone. @Sulbha-Mishra29 https://github.com/Sulbha-Mishra29

— Reply to this email directly, view it on GitHub https://github.com/datso/react-native-pjsip/issues/182#issuecomment-1046176044, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASWEYLHBH37YZZMKA2LKKGTU4CGQ5ANCNFSM4HNI2Z6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

marufMunshi commented 2 years ago

Yes, but not by me. I don't have any experience with Android. This is done by another developer in my company. @Sulbha-Mishra29