summaryrefslogtreecommitdiffstats
path: root/bindings/csharp/test
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/csharp/test')
-rw-r--r--bindings/csharp/test/Program.cs763
-rw-r--r--bindings/csharp/test/Properties/AssemblyInfo.cs36
-rw-r--r--bindings/csharp/test/test.csproj245
-rw-r--r--bindings/csharp/test/test.csproj.user6
4 files changed, 1050 insertions, 0 deletions
diff --git a/bindings/csharp/test/Program.cs b/bindings/csharp/test/Program.cs
new file mode 100644
index 0000000..032852b
--- /dev/null
+++ b/bindings/csharp/test/Program.cs
@@ -0,0 +1,763 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using org.doubango.tinyWRAP;
+
+namespace test
+{
+ class Program
+ {
+ public const String REALM = "open-ims.test";
+ public const String USER = "122";
+ public const String PROXY_CSCF_IP = "192.168.0.10";
+ public const ushort PROXY_CSCF_PORT = 5060;
+ public const String PASSWORD = "mamadou";
+ public const String SMSC = "123";
+
+ /*
+ const String REALM = "sip2sip.info";
+ const String USER = "2233392625";
+ const String PASSWORD = "d3sb7j4fb8";
+ const String PROXY_CSCF_IP = "192.168.0.13";
+ const uint PROXY_CSCF_PORT = 5081;
+ */
+
+ static void Main(string[] args)
+ {
+ Boolean success;
+
+ /* Create callbacks */
+ sipCallback = new MySipCallback();
+ msrpCallback = new MyMsrpCallback();
+ //sipDebugCallback = new MySipDebugCallback();
+
+ /* Create consumers */
+ audioConsumer = new MyProxyAudioConsumer();
+ videoConsumer = new MyProxyVideoConsumer(tmedia_chroma_t.tmedia_rgb565le);
+ /* Create producers */
+ audioProducer = new MyProxyAudioProducer();
+ videoProducer = new MyProxyVideoProducer(tmedia_chroma_t.tmedia_rgb24);
+
+
+ /* Create and configure the IMS/LTE stack */
+ sipStack = new SipStack(sipCallback, String.Format("sip:{0}", REALM), /*String.Format("{0}@{1}", USER, REALM)*/USER, String.Format("sip:{0}@{1}", USER, REALM));
+ sipStack.setDebugCallback(sipDebugCallback);
+ sipStack.addHeader("Allow", "INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER");
+ sipStack.addHeader("Privacy", "header; id");
+ sipStack.addHeader("P-Access-Network-Info", "ADSL;utran-cell-id-3gpp=00000000");
+ sipStack.addHeader("User-Agent", "IM-client/OMA1.0 doubango/v1.0.0");
+
+ /* Do it after stack creation */
+ ProxyAudioConsumer.registerPlugin();
+ ProxyAudioProducer.registerPlugin();
+ ProxyVideoProducer.registerPlugin();
+ ProxyVideoConsumer.registerPlugin();
+
+
+ /* Sets Proxy-CSCF */
+ success = sipStack.setProxyCSCF(PROXY_CSCF_IP, PROXY_CSCF_PORT, "udp", "ipv4");
+ // STUN
+ //sipStack.setSTUNServer("numb.viagenie.ca", 3478);
+ //sipStack.setSTUNCred("login", "password");
+ // DNS Discovery
+ //sipStack.setDnsDiscovery(true);
+ /* Starts the stack */
+ success = sipStack.start();
+
+ /* Set Password */
+ sipStack.setPassword(PASSWORD);
+
+ /* Early IMS */
+ sipStack.setEarlyIMS(true);
+ /* AMF and Operator Id */
+ sipStack.setAMF("0x00FF");
+ sipStack.setOperatorId("0xFF0000000000000000000000000000FF");
+
+ // SigComp
+ //sipStack.addSigCompCompartment("urn:uuid:2e5fdc76-00be-4314-8202-1116fa82a876");
+
+ //sipStack.setAoR("127.0.0.1", 1234);
+
+ audioConsumer.setActivate(true);
+ audioProducer.setActivate(true);
+ videoProducer.setActivate(true);
+ videoConsumer.setActivate(true);
+
+
+ /* Send REGISTER */
+ regSession = new RegistrationSession(sipStack);
+ regSession.addCaps("+g.oma.sip-im");
+ regSession.addCaps("+g.3gpp.smsip");
+ regSession.addCaps("language", "\"en,fr\"");
+ regSession.setExpires(350);
+ //regSession.addSigCompCompartment("urn:uuid:2e5fdc76-00be-4314-8202-1116fa82a876");
+ regSession.register_();
+
+ Console.ReadLine();
+
+
+ ActionConfig actionConfig = new ActionConfig();
+ actionConfig
+ .setMediaString(twrap_media_type_t.twrap_media_msrp, "file-path", "C:\\Users\\root\\Desktop\\Debian.iso")
+ //.setMediaString(twrap_media_type_t.twrap_media_msrp, "file-path", "C:\\avatar.png")
+ .setMediaString(twrap_media_type_t.twrap_media_msrp, "accept-types", "application/octet-stream")
+ .setMediaString(twrap_media_type_t.twrap_media_msrp, "file-disposition", "attachment")
+ .setMediaString(twrap_media_type_t.twrap_media_msrp, "file-icon", "cid:test@doubango.org")
+ .setMediaInt(twrap_media_type_t.twrap_media_msrp, "chunck-duration", 500);
+ MsrpSession msrpSession = new MsrpSession(sipStack, msrpCallback);
+ msrpSession.callMsrp(String.Format("sip:johndoe@{0}", REALM), actionConfig);
+ actionConfig.Dispose();
+
+ Console.ReadLine();
+ msrpSession.hangup();
+ Console.ReadLine();
+
+ //RPMessage rpMessage = SMSEncoder.encodeDeliver(25, SMSC, "123456789", "salut comment tu vas?\n hdjdhfjfhfjhr, ");
+ //if (rpMessage != null)
+ //{
+ // uint pay_len = rpMessage.getPayloadLength();
+ // if (pay_len > 0)
+ // {
+ // byte[] pay = new byte[pay_len];
+ // rpMessage.getPayload(pay, (uint)pay.Length);
+
+ // MessagingSession m = new MessagingSession(sipStack);
+ // m.setToUri(String.Format("sip:{0}@{1}", SMSC, REALM));
+ // m.addHeader("Content-Type", "application/vnd.3gpp.sms");
+ // m.addHeader("Content-Transfer-Encoding", "binary");
+ // m.addHeader("P-Asserted-Identity", String.Format("sip:{0}@{1}", USER, REALM));
+
+ // m.send(pay, (uint)pay.Length);
+
+ // m.Dispose();
+ // }
+ // rpMessage.Dispose();
+ //}
+
+ //Console.ReadLine();
+
+
+
+
+ //String sipUri = sipStack.dnsENUM("E2U+SIP", "+1-800-555-5555", "e164.org");
+ //ushort port = 0;
+ //String ipAddress = sipStack.dnsNaptrSrv("sip2sip.info", "SIP+D2U", out port);
+ //String ipAddress = sipStack.dnsSrv("_sip._udp.sip2sip.info", out port);
+
+ /*ActionConfig actionConfig = new ActionConfig();
+ actionConfig.setMediaInt(twrap_media_type_t.twrap_media_audiovideo, "bandwidth-level", (int)tmedia_bandwidth_level_t.tmedia_bl_medium);
+ callSession = new CallSession(sipStack);
+ callSession.set100rel(true);
+ callSession.setSessionTimer(90, "uas");
+ callSession.setQoS(tmedia_qos_stype_t.tmedia_qos_stype_segmented, tmedia_qos_strength_t.tmedia_qos_strength_optional);
+ callSession.callVideo(String.Format("sip:bob@{0}", REALM), actionConfig);
+ actionConfig.Dispose();*/
+
+ //tcb = new TimerCallback(OnTimer);
+ //timer = new Timer(tcb, new AutoResetEvent(false), 0, 20);
+
+ //Console.ReadLine();
+ //callSession.sendDTMF(1);
+ //Console.ReadLine();
+ //callSession.sendDTMF(2);
+ //Console.ReadLine();
+ //callSession.sendDTMF(11);
+ //Console.ReadLine();
+
+ ////Console.ReadLine();
+ ////callSession.hold();
+ ////Console.ReadLine();
+ ////callSession.resume();
+ //Console.ReadLine();
+ //callSession.hangup();
+
+
+ ////Thread.Sleep(2000);
+
+ /*RPData rpdata = SMSEncoder.encodeSubmit(25, "+33160188661", "+33660188661", "salut");
+ if (rpdata != null)
+ {
+ uint pay_len = rpdata.getPayloadLength();
+ if (pay_len > 0)
+ {
+ byte[] pay = new byte[pay_len];
+ rpdata.getPayload(pay, (uint)pay.Length);
+
+ MessagingSession m = new MessagingSession(sipStack);
+ m.setToUri(String.Format("sip:+33160188661@{0}", REALM));
+ m.addHeader("Content-Type", "application/vnd.3gpp.sms");
+ m.addHeader("Transfer-Encoding", "binary");
+ m.send(pay, (uint)pay.Length);
+
+ m.Dispose();
+ }
+ rpdata.Dispose();
+ }
+
+ Console.ReadLine();*/
+
+ ///* Send SUBSCRIBE(reg) */
+ //subSession = new SubscriptionSession(sipStack);
+ //subSession.addHeader("Event", "reg");
+ //subSession.addHeader("Accept", "application/reginfo+xml");
+ //subSession.addHeader("Allow-Events", "refer, presence, presence.winfo, xcap-diff, conference");
+ //subSession.setExpires(35);
+ ////subSession.Subscribe();
+
+ ///* Send MESSAGE */
+ //MessagingSession msg = new MessagingSession(sipStack);
+ //byte [] content = Encoding.ASCII.GetBytes("Hello World");
+ //msg.setToUri(String.Format("sip:{0}@{1}", "alice", REALM));
+ //msg.addHeader("NS", "imdn <urn:ietf:params:imdn>");
+ //msg.addHeader("imdn.Message-ID", "34jk324j");
+ //msg.addHeader("DateTime", "2006-04-04T12:16:49-05:00");
+ //msg.addHeader("imdn.Disposition-Notification", "positive-delivery, negative-delivery");
+ //msg.addHeader("Content-Type", "text/plain");
+ ////msg.Send(content, (uint)content.Length);
+
+ ///* Send OPTIONS */
+ //OptionsSession opt = new OptionsSession(sipStack);
+ //opt.setToUri(String.Format("sip:{0}@{1}", "hacking_the_aor", REALM));
+ //opt.Send();
+
+ Console.ReadLine();
+
+ sipStack.stop();
+ }
+
+
+ public static void OnTimer(Object stateInfo)
+ {
+ //byte[] bytesAudio = new byte[320];
+ //uint ret = audioConsumer.pull(bytesAudio, (uint)bytesAudio.Length);
+ //Console.WriteLine("pull="+ret);
+
+ //int ret2 = audioProducer.push(bytesAudio, (uint)bytesAudio.Length);
+ //Console.WriteLine("push=" + ret);
+
+ //byte[] bytesVideo = new byte[176*144*3];
+ //int ret3 = videoProducer.push(bytesVideo, (uint)bytesVideo.Length);
+ }
+
+ static Timer timer;
+ static TimerCallback tcb;
+ static CallSession callSession;
+ static RegistrationSession regSession;
+ static SubscriptionSession subSession;
+ public static MyMsrpCallback msrpCallback;
+ static MySipCallback sipCallback;
+ public static SipStack sipStack;
+ static MySipDebugCallback sipDebugCallback;
+ static MyProxyAudioConsumer audioConsumer;
+ static MyProxyAudioProducer audioProducer;
+ static MyProxyVideoProducer videoProducer;
+ public static MyProxyVideoConsumer videoConsumer;
+ }
+
+
+ public class MySipDebugCallback : DDebugCallback
+ {
+ public override int OnDebugInfo(string message)
+ {
+ Console.WriteLine(".NET____" + message);
+ return 0;
+ }
+
+ public override int OnDebugWarn(string message)
+ {
+ Console.WriteLine(".NET____" + message);
+ return 0;
+ }
+
+ public override int OnDebugError(string message)
+ {
+ Console.WriteLine(".NET____" + message);
+ return 0;
+ }
+
+ public override int OnDebugFatal(string message)
+ {
+ Console.WriteLine(".NET____" + message);
+ return 0;
+ }
+ }
+
+ public class MyProxyAudioConsumer : ProxyAudioConsumer
+ {
+ public override int prepare(int ptime, int rate, int channels)
+ {
+ return base.prepare(ptime, rate, channels);
+ }
+
+ public override int start()
+ {
+ return base.start();
+ }
+
+ public override int pause()
+ {
+ return base.pause();
+ }
+
+ public override int stop()
+ {
+ return base.stop();
+ }
+ }
+
+ public class MyProxyAudioProducer : ProxyAudioProducer
+ {
+ public override int prepare(int ptime, int rate, int channels)
+ {
+ return base.prepare(ptime, rate, channels);
+ }
+
+ public override int start()
+ {
+ return base.start();
+ }
+
+ public override int pause()
+ {
+ return base.pause();
+ }
+
+ public override int stop()
+ {
+ return base.stop();
+ }
+ }
+
+ public class MyProxyVideoProducer : ProxyVideoProducer
+ {
+ public MyProxyVideoProducer(tmedia_chroma_t chroma)
+ : base(chroma)
+ {
+ }
+
+ public override int prepare(int width, int height, int fps)
+ {
+ return base.prepare(width, height, fps);
+ }
+
+ public override int start()
+ {
+ return base.start();
+ }
+
+ public override int pause()
+ {
+ return base.pause();
+ }
+
+ public override int stop()
+ {
+ return base.stop();
+ }
+ }
+
+ public class MyProxyVideoConsumer : ProxyVideoConsumer
+ {
+ public MyProxyVideoConsumer(tmedia_chroma_t chroma)
+ : base(chroma)
+ {
+ }
+
+ public override int prepare(int width, int height, int fps)
+ {
+ return base.prepare(width, height, fps);
+ }
+
+ public override int start()
+ {
+ Program.videoConsumer.setDisplaySize(352, 288);
+ return base.start();
+ }
+
+ public override int consume(ProxyVideoFrame frame)
+ {
+ uint size = frame.getSize(); // for test
+ byte[] bytes = new byte[1200];
+ uint ret = frame.getContent(bytes, (uint)bytes.Length);
+ Program.videoConsumer.setDisplaySize(176, 144);
+ return 0;
+ }
+
+ public override int pause()
+ {
+ return base.pause();
+ }
+
+ public override int stop()
+ {
+ return base.stop();
+ }
+ }
+
+ public class MyMsrpCallback : MsrpCallback
+ {
+ public override int OnEvent(MsrpEvent e)
+ {
+ MsrpSession session = e.getSipSession();
+ MsrpMessage message = e.getMessage();
+ if (session != null && message != null)
+ {
+ uint id = session.getId();
+ //Console.WriteLine("Msrp Event {0} {1}", id, message.getMsrpHeaderValue("Byte-Range"));
+
+ long start, end, total;
+ //message.getByteRange(out start, out end, out total);
+ //Console.WriteLine("Byte-Range {0}-{1}/{2}", start, end, total);
+
+ //if (message.isRequest())
+ // {
+ // uint size = message.getMsrpContentLength();
+ // byte[] bytes = new byte[(int)size];
+ // message.getMsrpContent(bytes, (uint)bytes.Length);
+ // }
+
+
+ if (!message.isRequest() && message.getCode() == 200)
+ {
+ if (message.isLastChunck())
+ {
+ session.hangup();
+ }
+ }
+ }
+ return 0;
+ }
+ }
+
+ public class MySipCallback : SipCallback
+ {
+ public MySipCallback()
+ : base()
+ {
+ }
+
+ public override int OnRegistrationEvent(RegistrationEvent e)
+ {
+ short code = e.getCode();
+ tsip_register_event_type_t type = e.getType();
+ RegistrationSession session = e.getSession();
+ SipMessage message = e.getSipMessage();
+
+ if (message != null)
+ {
+ Console.WriteLine("call-id={0}", message.getSipHeaderValue("call-id"));
+ //byte[] bytes = message.getContent();
+ }
+
+ switch (type)
+ {
+ case tsip_register_event_type_t.tsip_ao_register:
+ case tsip_register_event_type_t.tsip_ao_unregister:
+ break;
+ }
+
+ Console.WriteLine("OnRegistrationChanged() ==> {0}:{1}", code, e.getPhrase());
+
+ return 0;
+ }
+
+ public override int OnInviteEvent(InviteEvent e)
+ {
+ tsip_invite_event_type_t type = e.getType();
+ InviteSession session = e.getSession();
+ SipMessage message = e.getSipMessage();
+
+ switch(type){
+ case tsip_invite_event_type_t.tsip_i_newcall:
+ SdpMessage sdp = message.getSdpMessage();
+
+ if (session != null){
+ Console.WriteLine("ERRRRRRRRRRRORRRR");
+ return 0;
+ }
+ else{
+ switch(e.getMediaType()){
+ case twrap_media_type_t.twrap_media_audio:
+ case twrap_media_type_t.twrap_media_video:
+ case twrap_media_type_t.twrap_media_audiovideo:
+ session = e.takeCallSessionOwnership();
+ break;
+ case twrap_media_type_t.twrap_media_msrp:
+ if ((session = e.takeMsrpSessionOwnership()) != null){
+ (session as MsrpSession).setCallback(Program.msrpCallback);
+ }
+ break;
+ }
+ if(session != null){
+ ActionConfig actionConfig = new ActionConfig();
+ session.accept(actionConfig);
+ actionConfig.Dispose();
+ }
+ }
+
+ /*else if ((session = e.takeSessionOwnership()) != null)
+ {
+ SdpMessage sdp = message.getSdpMessage();
+ if (sdp != null)
+ {
+ String fileSelector = sdp.getSdpHeaderAValue("message", "file-selector");
+ Console.WriteLine("file-selector={0}", fileSelector);
+ }
+
+ ActionConfig actionConfig = new ActionConfig();
+ //actionConfig.setMediaInt(twrap_media_type_t.twrap_media_audiovideo, "bandwidth-level", (int)tmedia_bandwidth_level_t.tmedia_bl_low);
+ actionConfig.setMediaString(twrap_media_type_t.twrap_media_file, "file-path", "C:\\tmp\\myfile");
+ session.accept(actionConfig);
+ actionConfig.Dispose();
+ }*/
+ break;
+ case tsip_invite_event_type_t.tsip_i_request:
+ break;
+ case tsip_invite_event_type_t.tsip_ao_request:
+ break;
+ case tsip_invite_event_type_t.tsip_o_ect_ok:
+ break;
+ case tsip_invite_event_type_t.tsip_o_ect_nok:
+ break;
+ case tsip_invite_event_type_t.tsip_i_ect:
+ break;
+ case tsip_invite_event_type_t.tsip_m_local_hold_ok:
+ Console.WriteLine("Local Hold OK");
+ break;
+ case tsip_invite_event_type_t.tsip_m_local_hold_nok:
+ Console.WriteLine("Local Hold NOK");
+ break;
+ case tsip_invite_event_type_t.tsip_m_local_resume_ok:
+ Console.WriteLine("Local Resume OK");
+ break;
+ case tsip_invite_event_type_t.tsip_m_local_resume_nok:
+ Console.WriteLine("Local Resume NOK");
+ break;
+ case tsip_invite_event_type_t.tsip_m_remote_hold:
+ Console.WriteLine("Remote Hold");
+ break;
+ case tsip_invite_event_type_t.tsip_m_remote_resume:
+ Console.WriteLine("Remote Resume");
+ break;
+ }
+
+
+
+
+
+
+
+ return 0;
+ }
+
+ public override int OnOptionsEvent(OptionsEvent e)
+ {
+ short code = e.getCode();
+ tsip_options_event_type_t type = e.getType();
+ OptionsSession session = e.getSession();
+ SipMessage message = e.getSipMessage();
+
+ if (message != null)
+ {
+ Console.WriteLine("call-id={0}", message.getSipHeaderValue("call-id"));
+ //byte[] bytes = message.getContent();
+ }
+
+ switch (type)
+ {
+ case tsip_options_event_type_t.tsip_ao_options:
+ String rport = message.getSipHeaderParamValue("v", "rport");
+ String received_ip = message.getSipHeaderParamValue("v", "received");
+ if (rport == null)
+ { /* Ericsson SDS */
+ rport = message.getSipHeaderParamValue("v", "received_port_ext");
+ }
+ Console.WriteLine("Via(rport, received)=({0}, {1})", rport, received_ip);
+ break;
+ case tsip_options_event_type_t.tsip_i_options:
+ break;
+ }
+
+ Console.WriteLine("OnRegistrationChanged() ==> {0}:{1}", code, e.getPhrase());
+
+ return 0;
+ }
+
+ public override int OnMessagingEvent(MessagingEvent e)
+ {
+ short code = e.getCode();
+ tsip_message_event_type_t type = e.getType();
+ MessagingSession session = e.getSession();
+ SipMessage message = e.getSipMessage();
+
+ if (session == null && message != null)
+ { /* "Server-side-session" e.g. Initial MESSAGE/INVITE sent by the remote party */
+ session = e.takeSessionOwnership();
+ }
+
+ //Console.WriteLine("From:{0} == To:{1}", message.getSipHeaderValue("f"), message.getSipHeaderValue("t"));
+ if (message == null)
+ {
+ return 0;
+ }
+
+ switch (type)
+ {
+ case tsip_message_event_type_t.tsip_i_message:
+ byte[] content = message.getSipContent();
+ if (content != null)
+ {
+ Console.WriteLine("Message Content ==> {0}", Encoding.UTF8.GetString(content));
+ session.accept();
+
+ String contentType = message.getSipHeaderValue("c");
+ if (contentType != null && contentType.Equals("application/vnd.3gpp.sms", StringComparison.InvariantCultureIgnoreCase))
+ {
+ SMSData smsData = SMSEncoder.decode(content, (uint)content.Length, false);
+ if (smsData != null)
+ {
+ twrap_sms_type_t smsType = smsData.getType();
+ if (smsType == twrap_sms_type_t.twrap_sms_type_rpdata)
+ {
+ uint payLength = smsData.getPayloadLength();
+ String P_Asserted_Identity = message.getSipHeaderValue("P-Asserted-Identity");
+ if (payLength > 0)
+ {
+ /* Send RP-ACK */
+ String destination = smsData.getOA();
+ RPMessage rpACK = SMSEncoder.encodeACK(smsData.getMR(), Program.SMSC, destination == null ? "123456789" : destination, false);
+ if (rpACK != null)
+ {
+ uint pay_len = rpACK.getPayloadLength();
+ if (pay_len > 0)
+ {
+ byte[] pay = new byte[pay_len];
+ rpACK.getPayload(pay, (uint)pay.Length);
+
+ //byte[] pay = Encoding.UTF8.GetBytes("\x03\x01\x41\x09\x01\x00\x01\x80\x01\x32\x42\x00\x69");
+
+ MessagingSession m = new MessagingSession(Program.sipStack);
+ m.setToUri(String.Format("sip:{0}@{1}", Program.SMSC, Program.REALM));
+ m.addHeader("Content-Type", "application/vnd.3gpp.sms");
+ m.addHeader("Content-Transfer-Encoding", "binary");
+ m.send(pay, (uint)pay.Length);
+
+ m.Dispose();
+ }
+ rpACK.Dispose();
+ }
+
+ /* Print payload */
+ byte[] payload = new byte[payLength];
+ smsData.getPayload(payload, (uint)payload.Length);
+ Console.WriteLine("SMS content ={0} and OA={1}", Encoding.UTF8.GetString(payload), smsData.getOA());
+ }
+ else
+ {
+ /* Send RP-ERROR */
+ /* payload is mandatory in RP-DATA messages */
+ /* Send RP-ACK */
+ String destination = smsData.getOA();
+ RPMessage rpError = SMSEncoder.encodeError(smsData.getMR(), Program.SMSC, destination == null ? "123456789" : destination, false);
+ if (rpError != null)
+ {
+ uint pay_len = rpError.getPayloadLength();
+ if (pay_len > 0)
+ {
+ byte[] pay = new byte[pay_len];
+ rpError.getPayload(pay, (uint)pay.Length);
+
+ MessagingSession m = new MessagingSession(Program.sipStack);
+ m.setToUri(String.Format("sip:{0}@{1}", Program.SMSC, Program.REALM));
+ m.addHeader("Content-Type", "application/vnd.3gpp.sms");
+ m.addHeader("Content-Transfer-Encoding", "binary");
+ m.send(pay, (uint)pay.Length);
+
+ m.Dispose();
+ }
+ rpError.Dispose();
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ session.reject();
+ }
+ break;
+ case tsip_message_event_type_t.tsip_ao_message:
+ break;
+ }
+
+ Console.WriteLine("OnMessagingEvent() ==> {0}:{1}", code, e.getPhrase());
+
+ return 0;
+ }
+
+ public override int OnSubscriptionEvent(SubscriptionEvent e)
+ {
+ short code = e.getCode();
+ tsip_subscribe_event_type_t type = e.getType();
+ SubscriptionSession session = e.getSession();
+ SipMessage message = e.getSipMessage();
+
+ switch (type)
+ {
+ case tsip_subscribe_event_type_t.tsip_ao_subscribe:
+ case tsip_subscribe_event_type_t.tsip_ao_unsubscribe:
+ break;
+
+ case tsip_subscribe_event_type_t.tsip_i_notify:
+ byte[] content = message.getSipContent();
+ if (content != null)
+ Console.WriteLine("Notify Content ==> {0}", Encoding.UTF8.GetString(content));
+ break;
+ }
+
+ Console.WriteLine("OnSubscriptioChanged() ==> {0}:{1}", code, e.getPhrase());
+
+ return 0;
+ }
+
+
+
+ const String PUBLISH_PAYLOAD = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
+"<presence xmlns:cp=\"urn:ietf:params:xml:ns:pidf:cipid\" xmlns:caps=\"urn:ietf:params:xml:ns:pidf:caps\" xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" xmlns:pdm=\"urn:ietf:params:xml:ns:pidf:data-model\" xmlns:p=\"urn:ietf:params:xml:ns:pidf-diff\" xmlns:op=\"urn:oma:xml:prs:pidf:oma-pres\" entity=\"sip:bob@ims.inexbee.com\" xmlns=\"urn:ietf:params:xml:ns:pidf\">" +
+ "<pdm:person id=\"RPVRYNJH\">" +
+ "<op:overriding-willingness>" +
+ "<op:basic>open</op:basic>" +
+ "</op:overriding-willingness>" +
+ "<rpid:activities>" +
+ "<rpid:busy />" +
+ "</rpid:activities>" +
+ "<rpid:mood>" +
+ "<rpid:guilty />" +
+ "</rpid:mood>" +
+ "<cp:homepage>http://doubango.org</cp:homepage>" +
+ "<pdm:note>Come share with me RCS Experience</pdm:note>" +
+ "</pdm:person>" +
+ "<pdm:device id=\"d0001\">" +
+ "<status>" +
+ "<basic>open</basic>" +
+ "</status>" +
+ "<caps:devcaps>" +
+ "<caps:mobility>" +
+ "<caps:supported>" +
+ "<caps:fixed />" +
+ "</caps:supported>" +
+ "</caps:mobility>" +
+ "</caps:devcaps>" +
+ "<op:network-availability>" +
+ "<op:network id=\"IMS\">" +
+ "<op:active />" +
+ "</op:network>" +
+ "</op:network-availability>" +
+ "<pdm:deviceID>urn:uuid:3ca50bcb-7a67-44f1-afd0-994a55f930f4</pdm:deviceID>" +
+ "</pdm:device>" +
+"</presence>";
+ }
+}
diff --git a/bindings/csharp/test/Properties/AssemblyInfo.cs b/bindings/csharp/test/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..a5f9dc9
--- /dev/null
+++ b/bindings/csharp/test/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("test")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("1903970d-f108-480c-bd31-9b394c9e9fa9")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/bindings/csharp/test/test.csproj b/bindings/csharp/test/test.csproj
new file mode 100644
index 0000000..7d46171
--- /dev/null
+++ b/bindings/csharp/test/test.csproj
@@ -0,0 +1,245 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{CE53BD89-639D-4F7D-BC47-FB82A294AFDC}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>test</RootNamespace>
+ <AssemblyName>test</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\ActionConfig.cs">
+ <Link>ActionConfig.cs</Link>
+ </Compile>
+ <Compile Include="..\CallSession.cs">
+ <Link>CallSession.cs</Link>
+ </Compile>
+ <Compile Include="..\DDebugCallback.cs">
+ <Link>DDebugCallback.cs</Link>
+ </Compile>
+ <Compile Include="..\DialogEvent.cs">
+ <Link>DialogEvent.cs</Link>
+ </Compile>
+ <Compile Include="..\InviteEvent.cs">
+ <Link>InviteEvent.cs</Link>
+ </Compile>
+ <Compile Include="..\InviteSession.cs">
+ <Link>InviteSession.cs</Link>
+ </Compile>
+ <Compile Include="..\MessagingEvent.cs">
+ <Link>MessagingEvent.cs</Link>
+ </Compile>
+ <Compile Include="..\MessagingSession.cs">
+ <Link>MessagingSession.cs</Link>
+ </Compile>
+ <Compile Include="..\MsrpCallback.cs">
+ <Link>MsrpCallback.cs</Link>
+ </Compile>
+ <Compile Include="..\MsrpEvent.cs">
+ <Link>MsrpEvent.cs</Link>
+ </Compile>
+ <Compile Include="..\MsrpMessage.cs">
+ <Link>MsrpMessage.cs</Link>
+ </Compile>
+ <Compile Include="..\MsrpSession.cs">
+ <Link>MsrpSession.cs</Link>
+ </Compile>
+ <Compile Include="..\OptionsEvent.cs">
+ <Link>OptionsEvent.cs</Link>
+ </Compile>
+ <Compile Include="..\OptionsSession.cs">
+ <Link>OptionsSession.cs</Link>
+ </Compile>
+ <Compile Include="..\ProxyAudioConsumer.cs">
+ <Link>ProxyAudioConsumer.cs</Link>
+ </Compile>
+ <Compile Include="..\ProxyAudioProducer.cs">
+ <Link>ProxyAudioProducer.cs</Link>
+ </Compile>
+ <Compile Include="..\ProxyVideoConsumer.cs">
+ <Link>ProxyVideoConsumer.cs</Link>
+ </Compile>
+ <Compile Include="..\ProxyVideoFrame.cs">
+ <Link>ProxyVideoFrame.cs</Link>
+ </Compile>
+ <Compile Include="..\ProxyVideoProducer.cs">
+ <Link>ProxyVideoProducer.cs</Link>
+ </Compile>
+ <Compile Include="..\PublicationEvent.cs">
+ <Link>PublicationEvent.cs</Link>
+ </Compile>
+ <Compile Include="..\PublicationSession.cs">
+ <Link>PublicationSession.cs</Link>
+ </Compile>
+ <Compile Include="..\RegistrationEvent.cs">
+ <Link>RegistrationEvent.cs</Link>
+ </Compile>
+ <Compile Include="..\RegistrationSession.cs">
+ <Link>RegistrationSession.cs</Link>
+ </Compile>
+ <Compile Include="..\RPMessage.cs">
+ <Link>RPMessage.cs</Link>
+ </Compile>
+ <Compile Include="..\SafeObject.cs">
+ <Link>SafeObject.cs</Link>
+ </Compile>
+ <Compile Include="..\SdpMessage.cs">
+ <Link>SdpMessage.cs</Link>
+ </Compile>
+ <Compile Include="..\SipCallback.cs">
+ <Link>SipCallback.cs</Link>
+ </Compile>
+ <Compile Include="..\SipEvent.cs">
+ <Link>SipEvent.cs</Link>
+ </Compile>
+ <Compile Include="..\SipMessage.cs">
+ <Link>SipMessage.cs</Link>
+ </Compile>
+ <Compile Include="..\SipSession.cs">
+ <Link>SipSession.cs</Link>
+ </Compile>
+ <Compile Include="..\SipStack.cs">
+ <Link>SipStack.cs</Link>
+ </Compile>
+ <Compile Include="..\SipUri.cs">
+ <Link>SipUri.cs</Link>
+ </Compile>
+ <Compile Include="..\SMSData.cs">
+ <Link>SMSData.cs</Link>
+ </Compile>
+ <Compile Include="..\SMSEncoder.cs">
+ <Link>SMSEncoder.cs</Link>
+ </Compile>
+ <Compile Include="..\StackEvent.cs">
+ <Link>StackEvent.cs</Link>
+ </Compile>
+ <Compile Include="..\SubscriptionEvent.cs">
+ <Link>SubscriptionEvent.cs</Link>
+ </Compile>
+ <Compile Include="..\SubscriptionSession.cs">
+ <Link>SubscriptionSession.cs</Link>
+ </Compile>
+ <Compile Include="..\tdav_codec_id_t.cs">
+ <Link>tdav_codec_id_t.cs</Link>
+ </Compile>
+ <Compile Include="..\thttp_event_type_t.cs">
+ <Link>thttp_event_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tinyWRAP.cs">
+ <Link>tinyWRAP.cs</Link>
+ </Compile>
+ <Compile Include="..\tinyWRAPPINVOKE.cs">
+ <Link>tinyWRAPPINVOKE.cs</Link>
+ </Compile>
+ <Compile Include="..\tmedia_bandwidth_level_t.cs">
+ <Link>tmedia_bandwidth_level_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tmedia_chroma_t.cs">
+ <Link>tmedia_chroma_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tmedia_qos_strength_t.cs">
+ <Link>tmedia_qos_strength_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tmedia_qos_stype_t.cs">
+ <Link>tmedia_qos_stype_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tmsrp_event_type_t.cs">
+ <Link>tmsrp_event_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tmsrp_request_type_t.cs">
+ <Link>tmsrp_request_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tsip_event_type_t.cs">
+ <Link>tsip_event_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tsip_invite_event_type_t.cs">
+ <Link>tsip_invite_event_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tsip_message_event_type_t.cs">
+ <Link>tsip_message_event_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tsip_options_event_type_t.cs">
+ <Link>tsip_options_event_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tsip_publish_event_type_t.cs">
+ <Link>tsip_publish_event_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tsip_register_event_type_t.cs">
+ <Link>tsip_register_event_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\tsip_subscribe_event_type_t.cs">
+ <Link>tsip_subscribe_event_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\twrap_media_type_t.cs">
+ <Link>twrap_media_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\twrap_rpmessage_type_t.cs">
+ <Link>twrap_rpmessage_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\twrap_sms_type_t.cs">
+ <Link>twrap_sms_type_t.cs</Link>
+ </Compile>
+ <Compile Include="..\XcapCallback.cs">
+ <Link>XcapCallback.cs</Link>
+ </Compile>
+ <Compile Include="..\XcapEvent.cs">
+ <Link>XcapEvent.cs</Link>
+ </Compile>
+ <Compile Include="..\XcapMessage.cs">
+ <Link>XcapMessage.cs</Link>
+ </Compile>
+ <Compile Include="..\XcapSelector.cs">
+ <Link>XcapSelector.cs</Link>
+ </Compile>
+ <Compile Include="..\XcapStack.cs">
+ <Link>XcapStack.cs</Link>
+ </Compile>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/bindings/csharp/test/test.csproj.user b/bindings/csharp/test/test.csproj.user
new file mode 100644
index 0000000..209cfef
--- /dev/null
+++ b/bindings/csharp/test/test.csproj.user
@@ -0,0 +1,6 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>
+ <StartWorkingDirectory>C:\Projects\Doubango\bindings\csharp\Debug\</StartWorkingDirectory>
+ </PropertyGroup>
+</Project> \ No newline at end of file
OpenPOWER on IntegriCloud