Difference between revisions of "Pnsamplecsharp"

From CDYNE Wiki
Jump to navigation Jump to search
imported>Jbrooks
(getVoices)
imported>Mbaughman
(NotifyPhoneBasic)
(5 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
<code type=csharp>
 
<code type=csharp>
  
            pnweb.PhoneNotify pn = new pnweb.PhoneNotify();
+
pnweb.PhoneNotify pn = new pnweb.PhoneNotify();
            Voice[] voices = pn.getVoices();
+
Voice[] voices = pn.getVoices();
  
            foreach (Voice item in voices)
+
//  Lists available voices in a console
            {
+
foreach (Voice item in voices)
                Console.WriteLine(item.VoiceSummary.ToString());
+
{
            }
+
    Console.WriteLine(item.VoiceSummary.ToString());
            Console.ReadKey(true);
+
}
 +
Console.ReadKey(true);
  
 
</code>
 
</code>
Line 24: Line 25:
 
=='''NotifyPhoneEnglishBasic'''==
 
=='''NotifyPhoneEnglishBasic'''==
 
<code type=csharp>
 
<code type=csharp>
namespace phnotify
+
 
{
+
pnweb.PhoneNotify pn = new pnweb.PhoneNotify();
    class Program
+
pnweb.NotifyReturn nr = pn.NotifyPhoneEnglishBasic("15555555555",
    {
+
"Hello, this is a test.","00000000-0000-0000-0000-000000000000");
        static void Main(string[] args)
+
 
        {
 
            pnweb.PhoneNotify pn = new pnweb.PhoneNotify();
 
            pnweb.NotifyReturn nr = pn.NotifyPhoneEnglishBasic("15555555555",
 
            "Hello, this is a test.","00000000-0000-0000-0000-000000000000");
 
        }
 
    }
 
 
 
</code>
 
</code>
  
 
=='''NotifyPhoneBasic'''==
 
=='''NotifyPhoneBasic'''==
 
<code type=csharp>
 
<code type=csharp>
namespace phnotify
+
 
{
+
pnweb.PhoneNotify pn = new pnweb.PhoneNotify();
    class Program
+
pnweb.NotifyReturn nr = pn.NotifyPhoneBasic("15555555555",
    {
+
"Hello, this is a test.", "1555555555", "Test Caller ID", "0", "0000000-0000-0000-0000-000000000000");
        static void Main(string[] args)
 
        {
 
            pnweb.PhoneNotify pn = new pnweb.PhoneNotify();
 
            pnweb.NotifyReturn nr = pn.NotifyPhoneBasic("15555555555",
 
            "Hello, this is a test.", "1555555555", "Test Caller ID", "0", "0000000-0000-0000-0000-000000000000");
 
        }
 
    }
 
}
 
  
 
</code>
 
</code>
 +
 
=='''NotifyPhoneBasicWithTransfer'''==
 
=='''NotifyPhoneBasicWithTransfer'''==
 
<code type=csharp>
 
<code type=csharp>

Revision as of 11:26, 26 October 2011

Samples of Phone Notify! in C#

getVoices

pnweb.PhoneNotify pn = new pnweb.PhoneNotify(); Voice[] voices = pn.getVoices();

// Lists available voices in a console foreach (Voice item in voices) {

   Console.WriteLine(item.VoiceSummary.ToString());

} Console.ReadKey(true);

UploadSoundFile

RecordSoundViaPhoneCall

NotifyPhoneEnglishBasic

pnweb.PhoneNotify pn = new pnweb.PhoneNotify(); pnweb.NotifyReturn nr = pn.NotifyPhoneEnglishBasic("15555555555", "Hello, this is a test.","00000000-0000-0000-0000-000000000000");

NotifyPhoneBasic

pnweb.PhoneNotify pn = new pnweb.PhoneNotify(); pnweb.NotifyReturn nr = pn.NotifyPhoneBasic("15555555555", "Hello, this is a test.", "1555555555", "Test Caller ID", "0", "0000000-0000-0000-0000-000000000000");

NotifyPhoneBasicWithTransfer

namespace phnotify {

   class Program
   {
       static void Main(string[] args)
       {
           pnweb.PhoneNotify pn = new pnweb.PhoneNotify();
           pnweb.NotifyReturn nr = pn.NotifyPhoneBasicWithTransfer("15555555555","15555555555",
           "Hello, this is a test. Press 0 to be transfered to the TransferNumber",
           "15555555555", "Test Caller ID", "0", "00000000-0000-0000-0000-000000000000");
       }
   }

}

NotifyPhoneBasicWithTryCount

namespace phnotify {

   class Program
   {
       static void Main(string[] args)
       {
           pnweb.PhoneNotify pn = new pnweb.PhoneNotify();
           pnweb.NotifyReturn nr = pn.NotifyPhoneBasicWithTryCount(3,"15555555555",
           "Hello, this is a test.", "1555555555", "Test Caller ID", "0", "00000000-0000-0000-0000-000000000000");
       }
   }

}

NotifyMultiplePhoneBasic

namespace phnotify {

   class Program
   {
       static void Main(string[] args)
       {
           pnweb.PhoneNotify pn = new pnweb.PhoneNotify();
           pnweb.NotifyReturn[] nr = pn.NotifyMultiplePhoneBasic("15555555555; 15555555555",
           "Hello, This is a test.", "15555555555", "Test Caller ID", "0", "00000000-0000-0000-0000-000000000000");
       }
   }

}

NotifyPhoneAdvanced

namespace phnotify {

   class Program
   {
       static void Main(string[] args)
       {
           pnweb.PhoneNotify pn = new pnweb.PhoneNotify();
           pnweb.AdvancedNotifyRequest anr = new pnweb.AdvancedNotifyRequest();
           anr.CallerIDName = "Test Caller ID";
           anr.CallerIDNumber = "15555555555";
           anr.PhoneNumberToDial = "15555555555";
           anr.TextToSay = "Hello, this is a test.";
           anr.LicenseKey = "00000000-0000-0000-0000-000000000000";
           anr.VoiceID = 0;
           anr.TryCount = 1;
           anr.NextTryInSeconds = 3600;
           anr.UTCScheduledDateTime = DateTime.UtcNow;
           pnweb.NotifyReturn response = pn.NotifyPhoneAdvanced(anr);
       }
   }

}

NotifyMultiplePhoneAdvanced

namespace phnotify {

   class Program
   {
       static void Main(string[] args)
       {
           pnweb.PhoneNotify pn = new pnweb.PhoneNotify();
           pnweb.AdvancedNotifyRequest anr = new pnweb.AdvancedNotifyRequest();
           anr.CallerIDName = "Test Caller ID";
           anr.CallerIDNumber = "15555555555";
           anr.PhoneNumberToDial = "15555555555; 15555555555; 15555555555";
           anr.TextToSay = "Hello, this is a test.";
           anr.LicenseKey = "00000000-0000-0000-0000-000000000000";
           anr.VoiceID = 0;
           anr.TryCount = 1;
           anr.NextTryInSeconds = 3600;
           anr.UTCScheduledDateTime = DateTime.UtcNow;
           pnweb.NotifyReturn response = pn.NotifyPhoneAdvanced(anr);
       }
   }

}