Welcome to the Ifbyphone Developers zone. This forum provides a place for the community of advanced Ifbyphone users and developers to share ideas, exchange code, and ask questions.  

Additional Resources

Ifbyphone Company Blog - Ifbyphone Twitter Page - Ifbyphone Company Web Site - Ifbyphone Partners Page
Ifbyphone's CEO's (Irv Shapiro's) Personal Blog - Irv Shapiro Twitter Page

It has been brought to our attention that the NEW MEMBER link does not always display in IE7. If you do not see the new member link in the login box on the right, please try another browser. (Firefox works fine.) In addition please note that Phonemashup accounts are completely separate from Ifbyphone accounts.

If you need help fast, call 877 295 5100 to reach the Ifbyphone "Success Team".   (Support is option 2.)

Members Login
Username 
 
Password 
    Remember Me  
Chatbox
Please log in to join the chat!
Post Info TOPIC: Web Response Issues
Vimal

Date: Nov 19, 2009
Web Response Issues
  
 


Hi,
    First of all, I am very much impressed with IFBY Phone... Good Works...
Now the problem:
I am in need of getting the status of the call. For this I used normal way of web request/response... But i got stuck in 1 place, where the response is obsolete...

The code snipped i used:
HttpWebRequest oWebRequest = WebRequest.Create(strURL.ToString()) as HttpWebRequest;
HttpWebResponse oWebResponse = oWebRequest.GetResponse() as HttpWebResponse;
using (var streamReader = new StreamReader(oWebResponse.GetResponseStream(), Encoding.UTF8))
{
strResult = streamReader.ReadToEnd();
}
File.WriteAllText("C:\\Save9.xml", strResult);

For a single phone number call it is giving the correct xml output. Whereas if it is multiple phone numbers, the response is not perfect...

Output 1: Single Phone number:
Working properly...

Output 2:3 Phone numbers
<?xml version='1.0' encoding='iso-8859-1'?>
<!DOCTYPE data [
  <!ELEMENT data (record+)>
  <!ELEMENT record ()>
]>
<data>
</data>

the actual web response:
<?xml version="1.0" encoding="iso-8859-1" ?>

  <!DOCTYPE data (View Source for full doctype...)>
- <data>
- <record>
  <Scheduled_Time>2009-10-06 14:26:00</Scheduled_Time>
  <Actual_Time>2009-10-06 14:26:18</Actual_Time>
  <Delay_if_Any>00:00:18</Delay_if_Any>
  <Number_Called>8627037335</Number_Called>
  <Result_of_Call>Answered</Result_of_Call>
  <Response_ID />
  <Broadcast_ID>5071161</Broadcast_ID>
  <Broadcast_Parameters>usr_survey_id=84431</Broadcast_Parameters>
  </record>
- <record>
  <Scheduled_Time>2009-10-06 14:28:00</Scheduled_Time>
  <Actual_Time>2009-10-06 14:28:37</Actual_Time>
  <Delay_if_Any>00:00:37</Delay_if_Any>
  <Number_Called>2222222222</Number_Called>
  <Result_of_Call>Busy signal, max attempts reached</Result_of_Call>
  <Response_ID />
  <Broadcast_ID>5071161</Broadcast_ID>
  <Broadcast_Parameters>usr_survey_id=84431</Broadcast_Parameters>
  </record>
- <record>
  <Scheduled_Time>2009-10-06 14:30:00</Scheduled_Time>
  <Actual_Time>2009-10-06 14:30:33</Actual_Time>
  <Delay_if_Any>00:00:33</Delay_if_Any>
  <Number_Called>8627037335</Number_Called>
  <Result_of_Call>Answered</Result_of_Call>
  <Response_ID />
  <Broadcast_ID>5071161</Broadcast_ID>
  <Broadcast_Parameters>usr_survey_id=84431</Broadcast_Parameters>
  </record>
  </data>

Hope you understood my problem clearly... If anything required, please revert to me!
-Vimal.



__________________


Veteran Member

Status: Offline
Posts: 58
Date: Nov 19, 2009
  
 

Vimal -

I'm not sure I understand exactly what the issue is. The XML you posted looks ok to me. So your code snippet is having a hard time parsing it - is that what is happening?

__________________


Member

Status: Offline
Posts: 10
Date: Nov 19, 2009
  
 

Hi,
Can you see the 2 different XML i posted? Here again for your reference,

Output:

]>


This is the output i am getting it for the actual xml[posted above], from the webresponse.

__________________


Member

Status: Offline
Posts: 10
Date: Nov 20, 2009
  
 

Hi,
I tried to paste that xml, but it is not pasted perfectly. The question is, if i use the url to get the status like this,

https://secure.ifbyphone.com/ibp_api.php?api_key=API_KEY&action=report.broadcast&start_date=2009-10-08&end_date=2009-10-08&broadcast_id=5118021

No.of calls scheduled on this broadcast id =1 then everything fine...

if No.Of Calls scheduled = 3 then the webresponse object is not giving the perfect xml.


Regards,
Vimal.

__________________


Veteran Member

Status: Offline
Posts: 58
Date: Nov 20, 2009
  
 

Vimal - can you please email me your account number? I will take a look directly, and see what I can find out.

kkeys AT ifbyphone DOT com

Thanks,
Khyle

__________________


Member

Status: Offline
Posts: 10
Date: Nov 20, 2009
  
 

User Id: <edited out>
Plz send me the code snippet to parse the response also...


-- Edited by KhyleK on Friday 20th of November 2009 08:51:19 AM

__________________


Veteran Member

Status: Offline
Posts: 58
Date: Nov 20, 2009
  
 

Vimal - I tested URL calls with some of your broadcasts that have 3 broadcasts, and the XML I get back is valid.

I do not have sample XML parsing code for .Net - but you can learn more about it at a couple of the links below:

http://articles.sitepoint.com/article/dot-net-xml/2

http://www.expertrating.com/courseware/DotNetCourse/DotNet-ASP.Net-10-1.asp

__________________


Member

Status: Offline
Posts: 10
Date: Nov 20, 2009
  
 

Thanks for your reply!
I tried this code snippet which was suggested by IfByPhone for asp: [Modified according to Asp.net]
HttpWebRequest oWebRequest = (HttpWebRequest)WebRequest.Create(strURL);
            HttpWebResponse oWebResponse = (HttpWebResponse)oWebRequest.GetResponse();
            StreamReader oStreamReader = new StreamReader(oWebResponse.GetResponseStream());
            String strRes = oStreamReader.ReadToEnd();

XmlDocument xDoc = new XmlDocument();
                xDoc.LoadXml(strRes);
                XmlNode oRoot = xDoc.DocumentElement;
                String strXMLNode = oRoot.OuterXml;

Can you just try this code from your end, please advice me to do some modifications in it...



__________________


Member

Status: Offline
Posts: 10
Date: Nov 20, 2009
  
 

Hi, 1 more hint... there is no problem with the XML parsing... I guess it is from webresponse.
I displayed the web response for this url, it gave me 157, whereas if i pass the single response url it is giving 957...

__________________


Veteran Member

Status: Offline
Posts: 58
Date: Nov 20, 2009
  
 

Vimal - Can you clarify the last post?

__________________
Anonymous

Date: Nov 22, 2009
  
 

Hi,
I mean to say, the content length of the web response is 157 for the URL i gave. but for the url which is having single phone number response the content length is 957... It means there is no content coming from response thats why xml looks blank.

__________________


Member

Status: Offline
Posts: 10
Date: Nov 24, 2009
  
 

Hi,
Any chance of finding the issue from your end!
I tried all the possible ways to pull out the web response but nothing worked out!

Regards,
Vimal.

__________________


Veteran Member

Status: Offline
Posts: 58
Date: Nov 24, 2009
  
 

Vimal - I am having trouble recreating the behavior you are seeing. Can you send me an email (see above) with the actual URLs and the exact responses? When I hit the URLs - I saw the expected XML.

Thanks

__________________


Member

Status: Offline
Posts: 10
Date: Nov 25, 2009
  
 

Hi,
No problem while hitting the url in the browser... but while taking the response from code i am facing the issue!!!

Regards,
Vimal.

__________________


Veteran Member

Status: Offline
Posts: 58
Date: Nov 25, 2009
  
 

Vimal - in order to help you, I will need the details I asked for above. As I mentioned, I cannot replicate the issue on my side. Can you please email me the exact URLs and responses? Thanks.

__________________


Member

Status: Offline
Posts: 10
Date: Nov 25, 2009
  
 

Email sent!

__________________
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.

Post to Facebook Post to Digg Post to Del.icio.us

This is an open and public forum so Ifbyphone is unable to ensure that all code and suggestions posted to this forum are correct. Please use all code posted here at your own risk. Ifbyphone assumes no liability for code, recommendations and suggestions posted to this forum.

Users and developers will find hundreds of useful posts at the Ifbyphone company blog.