Skip to content

407 Proxy Authentication Required #3

@wjgilmore

Description

@wjgilmore

Hi,

I'm sorry to bother you but I'm at wits' end attempting to get past this 407 Proxy Authentication Required issue. I'm providing my SIP username and password using setUsername() and setPassword(), respectively. I've confirmed the authentication works by way of making a successful call using Zoiper. Yet no matter what I do with the php-sip package I receive the 407 Proxy Authentication response.

--> INVITE sip:6149998888@gw1.sip.us SIP/2.0 <-- SIP/2.0 100 Trying

<-- SIP/2.0 407 Proxy Authentication Required

--> ACK sip:6149998888@gw1.sip.us SIP/2.0 --> INVITE sip:6148675309@gw1.sip.us SIP/2.0

<-- SIP/2.0 100 Trying New dialog: 92381.2484f1a5f06b7307c34ab1dd8d74150a.33cc.29daf5ef3b7663e00f2db8077dee2963@173.236.165.43

<-- SIP/2.0 407 Proxy Authentication Required --> ACK sip:6149998888@gw1.sip.us SIP/2.0

Any ideas? My code is effectively identical to that used in the README (SIP numbers/passwords etc removed):

<?php

require_once('PhpSIP.class.php');

    try {

      // if you get "Failed to obtain IP address to bind. Please set bind address manualy."
      // error, use the line below instead
      $api = new PhpSIP();

      $api->setDebug(true);

      $api->setUsername('123456789');
      $api->setPassword('password');

      $api->addHeader('Subject: click2call');
      $api->setMethod('INVITE');
      $api->setFrom('sip:123456789@gw1.sip.us');
      $api->setUri('sip:6149998888@gw1.sip.us');

      $res = $api->send();

      if ($res == 200) {

        $api->setMethod('REFER');
        $api->addHeader('Refer-to: sip:6149998888@gw1.sip.us');
        $api->addHeader('Referred-By: sip:123456789@gw1.sip.us');
        $api->send();

        $api->setMethod('BYE');
        $api->send();

        $api->listen('NOTIFY');
        $api->reply(481,'Call Leg/Transaction Does Not Exist');
      }

      if ($res == 'No final response in 5 seconds.') {
        $api->setMethod('CANCEL');
        $res = $api->send();
      }

      echo "RESULT: " . $res;

    } catch (Exception $e) {

      echo "Oops... Caught exception:";

      echo $e;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions