Jump to content

dial with curl


reco

Recommended Posts

i try to make a script to call a number with curl from the command line.

 

curl -v --user "user:pwd" hhttp://10.0.24.2/remote_call.htm?user=40%40buero-newyork.com&dest=26

 

but i only get 401 Unauthorized

 

 

 

curl -v --user ""user:pwd" http://10.0.24.2/remote_call.htm?user=40%4...com&dest=26

 

* Trying 10.0.24.2... connected

* Connected to 10.0.24.2 (10.0.24.2) port 80 (#0)

* Server auth using Basic with user '40'

> GET /remote_call.htm?user=40%40buero-newyork.com HTTP/1.1

> Authorization: Basic NDA6MWUycXcyc2QwMA==

> User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3

> Host: 10.0.24.2

> Accept: */*

>

< HTTP/1.1 401 Unauthorized

* Authentication problem. Ignoring this.

< Www-Authenticate: Basic REALM="buero-newyork.com"

< Content-Type: text/plain

< Content-Length: 22

<

Unauthorized request

* Connection #0 to host 10.0.24.2 left intact

* Closing connection #0

 

 

i would love to create this dialer for the mac addressbook. please help...

 

thanx

Link to comment
Share on other sites

Does it work if you do click2dial from the web interface? I guess "hhttp" is a typo? I guess you saw http://wiki.pbxnsip.com/index.php/Click_To_Dial.

 

hi yes thats a typo.

 

curl -v --user 40:sippwd http://10.0.24.2/remote_call.htm?user=40%4...com&dest=26

 

any idea?

i am ready to send you a addressbook plugin which you can post on your site to dial directly from the apple addressbook.

 

asap that call works :)

Link to comment
Share on other sites

Okay, I assume that 40@buero-newyork.com is a extension? And I assume that sippwd is the web password for that extension?

 

If that does not work, try including the parameter "auth" in the URL that contains the base64-encoded just in the CURL style user:password (like auth=40@buero-newyork.com:sippwd). Maybe there is something wrong with the CURL way of answering challenges.

Link to comment
Share on other sites

thanx i go it working the "" were missing arorund the url

 

 

______

(*

 

pbxnsip dialer for Apple AddressBook

by Christof Haemmerle reco@nex9.com v.1

 

edit the following properties in Script Editor and save this file (as script) into

 

~/Library/Address Book Plug-Ins/dialWithPbxnsip.scpt

*)

 

 

property myLogin : "40"

property myPassword : "yourpwd"

property pbxUrl : "10.0.24.2"

 

 

 

using terms from application "Address Book"

on action property

return "phone"

end action property

 

on action title for pers with fone

return "Dial with BNY Phone"

end action title

 

on should enable action for pers with fone

if label of fone contains "fax" then return false

return true

end should enable action

 

on perform action for pers with fone

 

set theNumber to (value of fone) as string

 

set cleanedNumber to CleanTheNumber(theNumber)

 

set theURL to "https://"

set theURL to theURL & pbxUrl & "/remote_call.htm?"

set theURL to theURL & "user=" & myLogin & "%40buero-newyork.com&"

set theURL to theURL & "dest=" & cleanedNumber

 

do shell script "curl -k -v --user " & myLogin & ":" & myPassword & " \"" & theURL & "\""

 

end perform action

 

 

end using terms from

 

 

on CleanTheNumber(numToDial) -- remove punctuation from a string, leaving just the number

set theDigits to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}

set cleanedNumber to ""

repeat with i from 1 to length of numToDial

set j to (character i of numToDial)

if j is in theDigits then set cleanedNumber to cleanedNumber & j

end repeat

return cleanedNumber

end CleanTheNumber

______

 

 

 

have fun

Link to comment
Share on other sites

  • 5 months later...

pbxnsip dialer for Apple AddressBook

 

this apple script lests you dial numbers directly form the address book on macosx tiger and leopard.

after installing you should have option 'Dial with Phone' when you click on a telephone number label.

 

 

// INSTALLATION //

 

1. download the script form here

 

1. unzip and save it to:

~/Library/Address Book Plug-Ins/dialWithPbxnsip.scpt

 

2. edit the properties acordingly to your setup. you can use script editor or any text editor

 

3. restart address book

Link to comment
Share on other sites

  • 3 years later...

Hi,

 

I am trying to use curl for getting response for call list.

 

In the command prompt :

 

> curl -v --user "admin:password" "http://10.xx.x.xx:8089/ajax.htm?action=call_list"

 

 

Response :

 

* About to connect() to 10.xx.x.xx port 8089 (#0)

* Trying 10.xx.x.xx...

* connected

* Connected to 10.xx.x.xx (10.xx.x.xx) port 8089 (#0)

* Server auth using Basic with user 'admin'

> GET /ajax.htm?action=call_list HTTP/1.1

> Authorization: Basic YWRtaW46Y2VudHJpMjAwOQ==

> User-Agent: curl/7.24.0 (i386-pc-win32) libcurl/7.24.0 zlib/1.2.5

> Host: 10.xx.x.xx:8089

> Accept: */*

>

< HTTP/1.1 302 Moved Temporarily

< Location: login.htm

< Content-Type: text/html

< Cache-Control: no-cache

< Cache-Control: no-store

< Set-Cookie: session=sspwdk60mq1cxq791yp3

< Content-Length: 156

<

<html><head>

<title>Redirect</title>

</head><body>

If you don't get redirected automatically, please click <a href="login.htm">here

</a>

</body></html>

* Connection #0 to host 10.xx.x.xx left intact

* Closing connection #0

 

What is the problem? Can you give an advice?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...