List of Blogs
Search Blogs
Blog Archive

Most recent blog entries

 

Jun16

Written by:Martin
16.06.2007 10:09 

Microsoft's new WindowsPowershell is not only a great administrative tool, but IMHO a must have for developers, too. I recently used it to try something with the SwyxIt-API. It's very easy with Powershell to investigate how the API work. Here's a short example to get you started:

Get a ClientLineMgr object and see what properties and methods are available:

PS>$clmgr = new-object -com clmgr.clientlinemgr                                                                         
PS>$clmgr | get-member                                                                                                  
TypeName: System.__ComObject#{f8e5536b-4c00-11d3-80bc-00105a653379}                                                  
Name                                     MemberType   Definition                                                        
----                                     ----------   ----------                                                        
ChangePbxPassword                        Method       void ChangePbxPassword (string, string)                           
DispAcknowledgeChatMessage               Method       void DispAcknowledgeChatMessage (uint, string, uint)              
DispConvertNumber                        Method       string DispConvertNumber (uint, string)                           
DispCreateConference                     Method       void DispCreateConference (int)                                   
DispCreateMediastreamingLink             Method       string DispCreateMediastreamingLink ()                            
DispDeleteMediastreamingLink             Method       void DispDeleteMediastreamingLink (string)                        
DispExternalHookStateChanged             Method       void DispExternalHookStateChanged (int, int)                      
DispGetExtension                         Method       string DispGetExtension (int)                                     
DispGetLine                              Method       IDispatch DispGetLine (int)                                       
DispInit                                 Method       int DispInit (string)                                             
DispInitEx                               Method       int DispInitEx (string, string)                                   
DispJoinAllToConference                  Method       void DispJoinAllToConference (int)                                
DispJoinLineToConference                 Method       void DispJoinLineToConference (int)                               
DispPickupCallbackOnBusyNotification     Method       void DispPickupCallbackOnBusyNotification (int)                   
DispPickupGroupNotificationCall          Method       void DispPickupGroupNotificationCall (int)                        
DispPlaySoundFile                        Method       void DispPlaySoundFile (string, int, int)                         
DispPlayToRtp                            Method       void DispPlayToRtp (string, int, uint)                            
DispPostMessage                          Method       void DispPostMessage (uint, uint, uint)                           
DispReadChatMessage                      Method       IDispatch DispReadChatMessage (uint)                              
DispRecordFromRtp                        Method       void DispRecordFromRtp (string, int, int)                         
DispRegisterChatMessageReader            Method       uint DispRegisterChatMessageReader ()                             
DispRegisterMessageTarget                Method       void DispRegisterMessageTarget (int, int)                         
DispRegisterUser                         Method       int DispRegisterUser (string)                                     
DispRejectCallbackOnBusyNotification     Method       void DispRejectCallbackOnBusyNotification ()                      
DispReleaseUser                          Method       void DispReleaseUser (int)                                        
DispRequestCallbackOnBusy                Method       void DispRequestCallbackOnBusy (string, string)                   
DispResolveNumber                        Method       string DispResolveNumber (string)                                 
DispSelectLine                           Method       int DispSelectLine (IDispatch)                                    
DispSelectLineNumber                     Method       int DispSelectLineNumber (int)                                    
DispSendChatMessage                      Method       void DispSendChatMessage (uint, string, string, uint)             
DispSetNumberOfLines                     Method       int DispSetNumberOfLines (int)                                    
DispSimpleDial                           Method       void DispSimpleDial (string)                                      
DispSimpleDialEx                         Method       uint DispSimpleDialEx (string)                                    
DispSimpleDialEx2                        Method       uint DispSimpleDialEx2 (string, int)                              
DispSimpleDialEx3                        Method       uint DispSimpleDialEx3 (string, int, int, string)                 
DispSkinGetActionAreaState               Method       uint DispSkinGetActionAreaState (uint, uint)                      
DispSkinGetInfoDetail                    Method       string DispSkinGetInfoDetail (uint)                               
DispSkinPhoneCommand                     Method       void DispSkinPhoneCommand (uint, uint)                            
DispSpeedDialName                        Method       string DispSpeedDialName (int)                                    
DispSpeedDialNumber                      Method       string DispSpeedDialNumber (int)                                  
DispSpeedDialState                       Method       int DispSpeedDialState (int)                                      
DispStopPlaySoundFile                    Method       void DispStopPlaySoundFile ()                                     
DispStopPlayToRtp                        Method       void DispStopPlayToRtp ()                                         
DispStopRecordFromRtp                    Method       void DispStopRecordFromRtp ()                                     
DispSwitchToLine                         Method       int DispSwitchToLine (IDispatch)                                  
DispSwitchToLineNumber                   Method       int DispSwitchToLineNumber (int)                                  
DispUnRegisterChatMessageReader          Method       void DispUnRegisterChatMessageReader (uint)                       
DispUnRegisterMessageTarget              Method       void DispUnRegisterMessageTarget (int, int)                       
DispVoicemailRemoteInquiry               Method       void DispVoicemailRemoteInquiry ()                                
PlaySoundFileCDS                         Method       void PlaySoundFileCDS (string, int, int, int, int, uint)          
PlaySoundFileDxCDS                       Method       void PlaySoundFileDxCDS (string, int, int, int, int)              
PlaySoundFileDxExCDS                     Method       void PlaySoundFileDxExCDS (string, int, int, int, int, int, in... 
PlayToRtpCDS                             Method       void PlayToRtpCDS (string, int, int, int, uint)                   
RecordFromRtpCDS                         Method       void RecordFromRtpCDS (string, int, int, int, int, int, int)      
RecordSoundFileCDS                       Method       void RecordSoundFileCDS (string, int, int, int, int)              
RegisterUserEx                           Method       void RegisterUserEx (string, string, string, string, int, int,... 
ReleaseUserEx                            Method       void ReleaseUserEx ()                                             
DispAreaCode                             Property     string DispAreaCode () {get}                                      
DispAutoDetectionBackupServer            Property     string DispAutoDetectionBackupServer () {get}                     
DispAutoDetectionEnabled                 Property     int DispAutoDetectionEnabled () {get}                             
DispAutoDetectionPrimaryServer           Property     string DispAutoDetectionPrimaryServer () {get}                    
DispAutoDetectionServerAvailable         Property     int DispAutoDetectionServerAvailable () {get}                     
DispConferenceLine                       Property     IDispatch DispConferenceLine () {get}                             
DispConferenceLineNumber                 Property     int DispConferenceLineNumber () {get}                             
DispConferenceRunning                    Property     int DispConferenceRunning () {get}                                
DispCountryCode                          Property     string DispCountryCode () {get}                                   
DispGetCallbackOnBusyNotifyPeerName      Property     string DispGetCallbackOnBusyNotifyPeerName () {get}               
DispGetCallbackOnBusyNotifyPeerNumber    Property     string DispGetCallbackOnBusyNotifyPeerNumber () {get}             
DispGetCurrentServer                     Property     string DispGetCurrentServer () {get}                              
DispGetCurrentUser                       Property     string DispGetCurrentUser () {get}                                
DispInternationCallPrefix                Property     string DispInternationCallPrefix () {get}                         
DispIsServerUp                           Property     int DispIsServerUp () {get}                                       
DispLongDistanceCallPrefix               Property     string DispLongDistanceCallPrefix () {get}                        
DispMicroEnabled                         Property     int DispMicroEnabled () {get} {set}                               
DispNotificationCallCalledExtension      Property     string DispNotificationCallCalledExtension () {get}               
DispNotificationCallCalledName           Property     string DispNotificationCallCalledName () {get}                    
DispNotificationCallPeerName             Property     string DispNotificationCallPeerName () {get}                      
DispNotificationCallPeerNumber           Property     string DispNotificationCallPeerNumber () {get}                    
DispNotificationCallRedirectedFromName   Property     string DispNotificationCallRedirectedFromName () {get}            
DispNotificationCallRedirectedFromNumber Property     string DispNotificationCallRedirectedFromNumber () {get}          
DispNotificationCallWasRedirected        Property     int DispNotificationCallWasRedirected () {get}                    
DispNumberOfExtensions                   Property     int DispNumberOfExtensions () {get}                               
DispNumberOfLines                        Property     int DispNumberOfLines () {get}                                    
DispNumberOfSpeedDials                   Property     int DispNumberOfSpeedDials () {get}                               
DispPublicAccessPrefix                   Property     string DispPublicAccessPrefix () {get}                            
DispSelectedLine                         Property     IDispatch DispSelectedLine () {get}                               
DispSelectedLineNumber                   Property     int DispSelectedLineNumber () {get}                               
DispSpeakerEnabled                       Property     int DispSpeakerEnabled () {get} {set}

There's a method DispSimpleCall. Let's use it to inititate a call:

PS>$clmgr.DispSimpleDial("0023147770")

That function produces no output, so powershell does not show anything. But SwyxIt! starts the call.

Now get the line currently selected in SwyxIt:

PS>$l = $clmgr.DispSelectedLine