How can we help you today?
Start a new topic

Delete Missed Calls via script Snom D785 (10.1.20.0)

Hi,


I tried to implement the script from http://wiki.snom.com/FAQ/How_to_delete_calls_from_missed_call_list_after_calling_back for the Snom D785 models. 


I think my problem is the line <<$handle = file("http://".$username.":".$password."@".$thisip."/index.htm");>> which will be used to read the missed calls from the web interface of the phone.

This is the Home-Site of the phones WebUI. However, there are no entries (even hidden ones) for missed calls on this page as shown on page http://wiki.snom.com/Snom760/Web_Interface/V8. Do I overlook something?


Is there another possibility to delete missed calls via script, SIP message or URL?


Thanks in advance


Marcus


Hi Marcus,


If the Home section shows no Missed calls, than normally it means that the phone does not have any missed calls so there is nothing to delete. Are you saying that your phone does not show any Missed calls if you open the web interface of the phone in a browser, login as admin and press Home? But if you look in the phone menu it does have missed calls? 


Thanks

Catalina

Hi Catalina,


Yes, that is what I say. :)

The WebUI does not show me the missed call. But the phone does. And Yes, I'm sure that I connected to the right WebUI. ;)

Attached you find a screenshot from the phone and the WebUI.


Thanks Marcus


Hi Marcus,


Can you please click on Settings and search for setting user_admin_mode ? Is this setting set to 1? If so than this is probably the reason, please either login as user or set user_admin_mode to 0. See https://service.snom.com/display/wiki/user_admin_mode for more information.


To change user_admin_mode to 0, you need to send an HTTP request to the phone, by entering something like this in your browser's address bar:  http://IP_ADDRESS/settings.htm?settings=save&user_admin_mode=0  . See https://service.snom.com/pages/viewpage.action?pageId=4882743 for more information.


Thanks

Catalina






Hello Catalina,


the user_admin_mode was empty. I set it to 0 and now I can the the missed calls in the WebUI. Tomorow I will try again to manipulate this list via script.


Thank you so far.


I will give you as quick as possible a response to my script tests.


Thanks

Marcus

Hello Catalina,


today I have tested again my script and faced a new problem. I'm not sure if I make a mistake or if it is a bug. An advice would be great.

I have the following line:

HTML
$content = file("http://<MyUsername>:<MyPassword>@<MyIPAddress>/index.htm");

In the PCap Trace of my phone (See attached screenshot) I can see that the request (#65) is send. The next few packages (#68 to #76) are "index out of bound"-errors related to the basic authorization string. This error causes the phone to answer the message with "unauthorized request" (#77).

Could it be possible that the phone only removes the "\r" from the end of the string and not the "\n"? Is this a configuration error in PHP / Linux / the Phone itself or is it a bug?

I could reproduce the error with firmware 10.1.20.0 and firmware 10.1.33.33.


Thanks in advance


Marcus

Hi Markus,


It seems that for some reason the script cannot authenticate to your phone. Can you try to fetch this page separately with curl or wget, something like this:

wget http://admin:1234@10.110.12.117/index.htm


I just tested the script with 10.1.33.33 and although for me the authentication worked, some other things did not work. The problems I found were related the page synthax. I changed the script a bit for 10.x, see new link in the FAQ:


Thanks

Catalina


Hello Catalina,

sorry for the late answer. Today I have tested my scripts again.

If I call the URL from a bash commandline with curl I get the message "Unauthorized request". In the PCAP trace I can see that the message is send with basic authentication. If i use the parameter "--digest" with my curl command I get the requested file without any error.

If I use the following code segment in PHP it also works for me:

...
$c = curl_init();
curl_setopt($c, CURLOPT_URL, "http://".$username.":".$password."@".$ip."/index.htm");
curl_setopt($c, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$content = explode("\n", curl_exec($c));
if (curl_error($c))
  die(curl_error($c));
curl_close($c);
...

So I checked my phone settings and found the http_scheme setting, which is by default set to on which equals "digest" authentication. After switching the option to off (which equals "basic" authentication) your script works.

If anybody want to use the digest authentication method with your script, he can use the above script segment instead of the line (Line 15 - 28.02.2019)

$handle = file("http://".$username.":".$password."@".$ip."/index.htm");

 and the following code segment instead of the line (Line 33 - 28.02.2019)

$handle = file("http://".$username.":".$password."@".$ip."/index.htm?misseddel=".$value);

.

...
$c = curl_init();
curl_setopt($c, CURLOPT_URL, "http://".$username.":".$password."@".$ip."/index.htm?misseddel=".$value);
curl_setopt($c, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$handle = curl_exec($c);
if (curl_error($c))
  die(curl_error($c));
curl_close($c);
...

 Thanks for your help. Please mark this thread as solved.

Greetings
Marcus

Hi Marcus,


Great! Thank you for sharing!


Best regards

Catalina


Login or Signup to post a comment