How to get DNIS in a UCMA 3.0 application - lync-2010

I'm developing IVR application by using UCMA 3 But not using lync server. When audio or video call is received i need to get DNIS of that. Is there any way to do this.
Thank you.

Sorry to take long time to post my own answer.
I found feasible solution(not sure is that perfect) for this. You can retrieve ANI and DNIS details in indirect manner by using CallRecievedEventArgs argument. To get ANI and DNIS as below
private static void AudioVideoCallReceived(object sender, CallReceivedEventArgs<AudioVideoCall> e)
{
SipUriParser CallerPartySipUri = new SipUriParser(e.Call.RemoteEndpoint.Uri);
SipUriParser CalledPartySipUri = new SipUriParser(e.RequestData.RequestUri);
Console.WriteLine("From(Caller party) : " + CallerPartySipUri.User + " To(Called Party)" + CalledPartySipUri.User);
}

Related

Error 403 - Forbidden on Loading Open Street Map to Win Form with GMap.Net and C#

Trying to load OSM on windows Form using C# and GMap.Net I am getting this error
Exception:The remote server returned an error: (403) Forbidden
private void Form1_Load(object sender, EventArgs e)
{
gMapControl1.DragButton = MouseButtons.Left;
gMapControl1.CanDragMap = true;
gMapControl1.MapProvider = GMapProviders.OpenStreetMap;
gMapControl1.Position = new GMap.NET.PointLatLng(54.6961334816182, 25.2985095977783);
gMapControl1.MinZoom = 0;
gMapControl1.MaxZoom = 24;
gMapControl1.Zoom = 9;
gMapControl1.AutoScroll = true;
}
Can you please let me know why this is happening and how I can fix it?
don't forget to set the instance mode to server/cache and set it to the instance of the open street map provider instead of 'GMapProviders.OpenStreetMap'
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache;
gMapControl1.MapProvider = GMap.NET.MapProviders.OpenStreetMapProvider.Instance;
It could also be your web proxy settings, see
https://stackoverflow.com/a/19609539/2368681
"Hi,
All libraries that send a fake user-agent and other faked headers to make the requests appear as if they are coming from web browsers are being blocked. Fix the headers and set a real User-Agent to identify your app and the requests will work again.
Please review our usage policy:
https://operations.osmfoundation.org/policies/tiles/ "
This is verbatim reply from OSM.
https://github.com/judero01col/GMap.NET/pull/45 is being used to track this issue. And hopefully a fix will be merged in a a day or two.
I changed Map Provider from "OpenStreetMapProvider" to "GoogleMapProvider" and the error disappeared.
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache;
mapView.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance;

How do I Auto Re-tweet Somebody or a Hashtag And Follow Them Using Tweetinvi

I want to make a automatic re-tweet/follow bot so I can follow and re-tweet certain people and RT a specific hashtag (#Giveaways) I am using Tweetinvi but I dont understand how to do these things I've listed.
I am the developer of Tweetinvi.
You could simply do the following:
Auth.SetUserCredentials("CONSUMER_KEY", "CONSUMER_SECRET", "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET");
var fs = Stream.CreateFilteredStream();
fs.AddTrack("#fnqifqun");
fs.MatchingTweetReceived += (sender, args) =>
{
var tweet = args.Tweet;
tweet.PublishRetweetAsync();
};
fs.StartStreamMatchingAllConditions();
Your bot is now complete!

Trouble posting comments with the LWUIT Facebook API

I'm working on a mobile project and decided to try out the LWUIT framework for development. So far it has been quite interesting although I wish the documentation was a bit better.
I run into a problem trying to post content to facebook using the recently released Facebook API. I'm able to authenticate without issues. However, when I try to post comments to the user's wall, I get a http 404 error.
Has anyone else had this sort of challenge. Below is an excerpt from my code;
protected boolean onShareScreenPost() {
// If the resource file changes the names of components this call will break notifying you that you should fix the code
//boolean val = super.onShareScreenPost();
Form shareForm = Display.getInstance().getCurrent();
final TextField shareField = findShareField(shareForm);
String postText = shareField.getText();
try {
makeFacebookAuthenticationRequest();
FaceBookAccess.getInstance().postOnWall(me.getId(), postText);
} catch (IOException ex) {
ex.printStackTrace();
//Include a dialog saying unable to post or connect to the internet or whatever
}
return true;
}
private void makeFacebookAuthenticationRequest() throws IOException {
FaceBookAccess.getInstance().authenticate("125527160846284", "http://a.b.c/", new String[]{ "publish_stream"});
me = new User();
FaceBookAccess.getInstance().getUser("me", me, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
System.out.println("returned user");
}
});
}
Seeing this question 24 hours later makes me feel a bit silly.
The answer was quite simple and staring me in the face all along. I needed to wait for the Facebook API to return a User object before making additional calls to the API. Failure to do this resulted in a null reference for my user object and this was being used in the wall post request causing the facebook api to return a http 404.
Hope this helps someone...

multiple pages with C# Web browser control

I am trying to download HTML content from any URL through webbrowser control in C#.net.
I choose webrowser to handle Javascript issues. I am using webbrowser control without placing
it on the form. It works great for one url, but when I call it for multiple urls I am unable
to download the page.
Here is the code
GetWebpage()
{
System.Windows.Forms.WebBrowser wb = new System.Windows.Forms.WebBrowser();
wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
wb.Navigate(sURI, false);
bDocumentLoaded = false;
while (!bDocumentLoaded)
{
Application.DoEvents();
Thread.Sleep(100);
}
sHTML = wb.DocumentText;
bDocumentLoaded = false;
}
Event:
private void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
System.Windows.Forms.WebBrowser webBrowser1;
webBrowser1 = sender as WebBrowser;
string strTit = webBrowser1.DocumentTitle;
string str = webBrowser1.DocumentText;
bDocumentLoaded = true;
}
Cheers,
Karthik
You can use webclient object to fetch data from some url.
Try using Downloading String
public static void DownloadString (string address)
{
WebClient client = new WebClient ();
string reply = client.DownloadString (address);
Console.WriteLine (reply);
}
You can also use ASYC method of same downloading string.
I think your problem is that some sites are detecting specific browsertype and then they are returning HTML
Try setting the HeaderProperty of WebClient Object this is a list of HttpWebRequest Object
For Example
myWebClient.Headers.Add("Content-Type","application/x-www-form-urlencoded");
Modify the useragent of HTTPWEBRequest then add to headers.
HTTPWEBRequest.UserAgent=".NET Framework Test Client";
You can check more information about this in MSDN Link
I might recommend using the mshtml and SHDocVW libraries and using approach found in the answer here:
Unable to to locate and click a submit button using mshtml.HTMLInputElement

BlackBerry - Facebook extended permissions

I've just found a great sample of Facebook Connect on Blackberry by Eki Y. Baskoro,
The following is a short HOWTO on using Facebook Connect on Blackberry. I created a simple Facade encapsulating the Facebook REST API as well as added 'rough' MVC approach for screen navigation. I have tested on JDE 4.5 using 8320 simulator. This is still work in progress and all work is GPLed.
It works great for reading stuff.
NB Don't forget to get Facebook App Key and set it in TestBB class.
But now I want to post something on my wall. So I've add new method to FacebookFacade class using Stream.publish API:
/***
* Publishes message to the stream.
* #param message - message that will appear on the facebook stream
* #param targetId - The ID of the user, Page, group, or event where
* you are publishing the content.
*/
public void streamPublish(String message, String targetId)
{
Hashtable arguments = new Hashtable();
arguments.put("method", "stream.publish");
arguments.put("message", message);
arguments.put("target_id", targetId);
try {
JSONObject result = new JSONObject(
int new JSONTokener(sendRequest(arguments)));
int errorCode = result.getInt("error_code");
if (errorCode != 0) System.out.println("Error Code: "+errorCode);
} catch (Exception e) {
System.out.println(e);
}
}
/***
* Publishes message on current user wall.
* #param message - message that will appear on the facebook stream
*/
public void postOnTheWall(String message)
{
String targetId = String.valueOf(getLoggedInUserId());
streamPublish(message, targetId);
}
This will return Error code 200, "The user hasn't authorized the application to perform this action"
First I thought it's related with Facebook -> Application Settings -> Additional Permissions -> Publish recent activity (one line stories) to my wall but even checked, no difference...
Then I've found this post explains that issue related with extended permissions.
This in turn should be fixed by modifying url a little in LoginScreen class :
public LoginScreen(FacebookFacade facebookFacade) {
this.facebookFacade = facebookFacade;
StringBuffer data = new StringBuffer();
data.append("api_key=" + facebookFacade.getApplicationKey());
data.append("&connect_display=popup");
data.append("&v=1.0");
//revomed
//data.append("&next=http://www.facebook.com/connect/login_success.html");
//added
data.append("&next=http://www.facebook.com/connect/prompt_permissions.php?" +
"api_key="+facebookFacade.getApplicationKey()+"&display=popup&v=1.0"+
"&next=http://www.facebook.com/connect/login_success.html?"+
"xxRESULTTOKENxx&fbconnect=true" +
"&ext_perm=read_stream,publish_stream,offline_access");
data.append("&cancel_url=http://www.facebook.com/connect/login_failure.html");
data.append("&fbconnect=true");
data.append("&return_session=true");
(new FetchThread("http://m.facebook.com/login.php?"
+ data.toString())).start();
}
Unfortunately it's not working. Still Error Code 200 in return to stream.publish request...
Do you have any suggestions how to resolve this?
Thank you!
I have posted the updated API on my website (http://www.baskoro.web.id/facebook-connect-blackberry-HOWTO.html) and this should solve this issue. Please let me know otherwise.
Salam. Cheers!
Eki