KNOB;
Well the first approached didnt work so I captured it to file and was able to extract the data that i needed.
Below is the script with a couple of outstanding issues that are documemted.;This script is for a Nortel Meridian PBX. ;The Craft personal must be logged in for this to Work. ;The suytem should be using VMA through the PBX to keep the names sync up. ;A default tn and key were used on the switchroom phone and should be changed to ; match the site where this is ran. ;By useing the test phone there is no interruption to the end user while the change ; is made. ;This program was written from material and examples from Aspect manual and Help, ; Other ideas were contributed from online forms and examples from the Internet. ; ;------------------------------ GLOABAL VARABLES ---------------------------- string dn1 ; 4 digit extension string firstN ; New First Name string lastN = "" ; New Last Name string fullN = "" ; Full name Varable string Vma = "99" ; Comparison to Voicemail string vcos = "99" ; Voice mail Class of service string dn2 ; 2nd extension in MerMail string dn3 ; 3rd extension in MerMail string EDN2 = "SECOND_DN" ; Expected String for 2nd extension string EDN3 = "THIRD_DN" ; Expected String for 3rd extension string Rdata = "Test.cap" ; Temp file string Fname = "c:\test.cap" ; File name to be opened and deleted string LineBuffer ; Line read from file. string tnb = "132 0 8 11" ; Site Tech phone string key = "16" ; Telset key to use string Cdn1 ; Complete dn string dastri = "" Integer Rgo = 0
;------------------------------------ MAIN -------------------------------- proc main when dialog 0 call handler0
dialogbox 0 8 20 264 169 194 "Name Change" editbox 1 115 20 34 11 DN1 4 editbox 2 115 40 34 11 firstN 12 editbox 3 115 60 34 11 LastN 16 editbox 4 115 80 34 11 TNB editbox 5 115 100 34 11 key 2 text 8 29 20 80 11 "Directory Number" left text 9 29 40 34 11 "First Name" left text 10 29 60 34 11 "Last Name" left text 11 29 80 66 11 "TNB to use" left text 12 29 100 56 11 "KEY to use" left pushbutton 6 35 149 40 13 "OK" ok pushbutton 7 113 149 40 13 "Cancel" cancel enddialog dlgupdate 0 1 dlgupdate 0 2 dlgupdate 0 3 dlgupdate 0 4 dlgupdate 0 5
endproc ;------------------------------ HANDLER0 ---------------------------------- proc handler0 integer event0 dlgevent 0 event0 switch event0 case 6 snext() endcase case 7 mdone() endcase endswitch endproc ;------------------------------- SNEXT ------------------------------------ proc snext
string Aname = "C:\PBX NAME CHANGE AUDIT.TXT" string dateinfo ; Date temp storage. string year ; year string month ; Month of year. string day ; Day of month. string daystr ; Day of week string. string hour ; hour. string minute ; Minute. string second ; Second. string stad = "" ; Command to be sent to Audit file. integer dayweek ; Day of the week. integer dayyear ; Day of the year. integer leapyear ; Leap year flag.
substr hour $TIME24 0 2 ; Get the Hour. substr minute $TIME24 3 2 ; Get the Minuet. substr second $TIME24 6 2 ; Get the Second. ltimemisc $LTIME DayWeek DayYear LeapYear ; Get the Day of Week Number. strcpy dateinfo $DATE ; Copy the date into the string. strtok month dateinfo "/" 1 ; Get the month. strtok day dateinfo "/" 1 ; Get the day. strtok year dateinfo "/" 1 ; Get the year itoa DayWeek Daystr ; Convert day of week to a string. strcat stad day ; Start building command to send to the CAT. strcat stad "/" ; strcat stad month ; strcat stad "/" ; strcat stad year ; strcat stad " " ; strcat stad hour ; strcat stad ":" ; strcat stad minute strcat stad ":" strcat stad second ; Command build finished.
if nullstr lastN ; Verifys that a last name was put in usermsg "Last name is required!" main() ; Causing trouble from runing multi times endif strcat fullN firstN ; Add First Name to Varable fullN strcat fullN "," ; Add , after Frist Name strcat fullN lastN ; Add Last Name to Varable fullN strcat Cdn1 "KEY " strcat Cdn1 key strcat Cdn1 " scr " strcat Cdn1 dn1 strcat Cdn1 "^M" strcat Dastri dn1 strcat Dastri " " strcat Dastri fullN strcat Dastri " " strcat Dastri stad if fopen 0 Aname APPEND TEXT ;Addes to the audit file what was done. fputs 0 Dastri fclose 0 else fopen 0 Aname CREATE fputs 0 Dastri fclose 0 endif ;---------------------------------Start actual transmitting---------------------------------------------- Transmit "****^M" ; Makes sure that craft person is not in any Loads waitfor ">" transmit "LD 20^M" ; Rls 19 and on for normal Name changes waitfor "REQ: " transmit "prt^M" waitfor "TYPE: " transmit "dnb^M" waitfor "CUST " transmit "0^M" ; For single Customer Site waitfor "DN " transmit DN1 transmit "^M" waitfor "DATE " if failure exit endif transmit "^M" waitfor "PAGE " transmit "^M" waitfor "DES " set capture path "c:\" set capture query OFF set capture overwrite on set capture file Rdata capture on transmit "^M" waitfor "NACT" capture off set capture path "C:\Program Files\Procomm Plus\Capture" set capture query on set capture overwrite off if fopen 0 Fname READ TEXT ; Open file for read only. while not feof 0 ; Loop while not end of file. fgets 0 LineBuffer ; Get line from file. strfind LineBuffer "VMB_COS" ; Get Voicemail class of Services if success Vcos = LineBuffer endif strfind LineBuffer EDN2 ; Get 2nd DN associated with mailbox if success DN2 = LineBuffer endif strfind LineBuffer EDN3 ; Get 3rd DN associated with mailbox if success DN3 = LineBuffer endif strfind LineBuffer "SCH0881" ; Non-existane DN in the Switch if success usermsg "That phone number does not exist in this switch" Nmain() ; Causing trouble from runing multi times exit ; Had to add to stop continue on from last step once completed endif endwhile fclose 0 ; Close file opened for read. else errormsg "Couldn't open file `"%s`"." Fname
endif strfind Vcos Vma if success NoVmail() ; Causing trouble from runing multi times exit ; Had to add to stop continue on from last step once completed endif strreplace Vcos " VMB_COS" "" ; Clean up the Varable Vcos strfind Vcos "0" ; Assigns a COS to a Mailbox if it doesn't have one if success Vcos = "1" ; The Default COS endif strreplace DN2 " SECOND_DN" "" ; Clean up the Varable DN2 strreplace DN3 " THIRD_DN" "" ; Clean up the Varable DN3 Transmit "^M" ; Phase 1 (Outing the Name and Mailbox) waitfor "REQ: " transmit "chg^M" waitfor "TYPE: " transmit "2616^M" waitfor "TN " transmit tnb transmit "^M" waitfor "ECHG " transmit "yes^M" waitfor "ITEM " transmit Cdn1 waitfor "MARP " transmit "^M" waitfor "CPND " transmit "out^M" waitfor "VMB " transmit "out^M" waitfor "KEY " transmit "^M" waitfor "ITEM " transmit "^M" ; Phase 2 (puting in the new name and adding Voice mail) waitfor "REQ: " transmit "chg^M" waitfor "TYPE: " transmit "2616^M" waitfor "TN " transmit tnb transmit "^M" waitfor "ECHG " transmit "yes ^M" waitfor "ITEM " transmit Cdn1 waitfor "MARP " transmit "^M" waitfor "CPND " transmit "new^M" waitfor "NAME " transmit fullN transmit "^M" waitfor "DISPLAY_FMT " transmit "^M" waitfor "VMB " transmit "new^M" waitfor "VMB_COS " transmit Vcos transmit "^M" waitfor "SECOND_DN " transmit dn2 transmit "^M" waitfor "THIRD_DN" transmit dn3 transmit "^M" waitfor "KEEP_MSGS" transmit "^M" waitfor " KEY " transmit "^M" waitfor "ITEM " transmit "^M" ; Phase 3 (Retuning the Key back to its null state) waitfor "REQ: " transmit "chg^M" waitfor "TYPE: " transmit "2616^M" waitfor "TN " transmit tnb transmit "^M" waitfor "ECHG " transmit "yes^M" waitfor "ITEM " transmit "key " transmit key transmit " nul^M" waitfor " KEY " transmit "^M" waitfor "ITEM " transmit "^M" waitfor "REQ: " transmit "END^M" waitfor ">" delfile Fname Fcheck() ; Causing trouble from runing multi times endproc
;------------------------------------------ NoVmail --------------------------------------
proc NoVmail ; Phase 1 (Removing the Name from the PBX) transmit "END^M" waitfor ">" transmit "LD 95^M" waitfor "REQ " transmit "out^M" waitfor "TYPE " transmit "name^M" waitfor "CUST " transmit "0^M" waitfor "DIG " transmit "^M" waitfor "DN " transmit dn1 transmit "^M" waitfor "DN " transmit "^M" waitfor "DCNO " transmit "^M" ; Phase 2 (Putting in the New Name) waitfor "REQ" transmit "new^M" waitfor "TYPE " transmit "name^M" waitfor "CUST " transmit "0^M" waitfor "DIG " transmit "^M" waitfor "DN" transmit dn1 transmit "^M" waitfor " NAME " transmit fullN transmit "^M" waitfor " DISPLAY_FMT " transmit "^M" waitfor "DN " transmit "^M" waitfor "DCNO " transmit "^M" waitfor "REQ " transmit "end^M" waitfor ">" delfile Fname Fcheck() ; Causing trouble from runing multi times
endproc
;--------------------------------------------- Fcheck ---------------------------------------
; Prints the DN back out for a visual verification proc Fcheck transmit "LD 20^M" waitfor "REQ" transmit "prt^M" waitfor "TYPE: " transmit "dnb^M" waitfor "CUST " transmit "0^M" waitfor "DN " transmit DN1 transmit "^M" waitfor "DATE " transmit "^M" waitfor "PAGE " transmit "^M" waitfor "DES " transmit "^M" waitfor "NACT" transmit "end^M" Mdone() ; Causing trouble from runing multi times endproc ;--------------------------------------------- Nmain --------------------------------------- proc Nmain dn1 = "" ; Reset String Varable to NULL firstN = "" ; Reset String Varable to NULL lastN = "" ; Reset String Varable to NULL fullN = "" ; Reset String Varable to NULL Cdn1 = "" main() while Rgo == 0 main() endwhile
endproc ;--------------------------------------------- mdone --------------------------------------- proc mdone exit endproc ; pending parts are to beable to run the script until cancel is pressed. ; errors noticed when going to sections. After it completes it wants ; to continue off where it jumped to that section ;
Thanks
|
|