TelecomAnimal
MIS
I'm trying to set up a script that will look up the port for a given extension # on a Meridian 1 PBX. Once it does so, I need the script to look for the port number and then delete the port programming. Unfortunately, I cannot get the script to "see" the lines of code that designate the port.
Here's the printout that the script will see:
REQ: PRT - these responses are ented by the script
TYPE: DNB
MARP NOT ACTIVATED
CUST 0
DN 2233
DATE
PAGE
DES
- response from PBX starts here
DN 2233
CPND
NAME John Smith
XPLN 13
DISPLAY_FMT FIRST,LAST
TYPE SL1
TN 036 0 06 01 KEY 00 H MARP DES PR5562 9 OCT 2006
(3904)
-response ends here
The line that starts with TN is where I want to start analyzing what comes in from the PBX. I'm using a WAITFOR to watch for the TN entry and then using an RGET to read the rest of the line. I may need to have multiple such lines read as I'm looking for the line with the entry MARP in it.
Here's the script so far...
string dn="2233", tn, readline, isthisthemarp, marp="marp"
integer marpnotfound=1
proc main
set txpace 50
call FindDN
call TNextract
; call OutTN [disabled for debugging]
set txpace 0
endproc
Proc FindDN
; SDLGINPUT "DN entry" "Please enter the number you want to look up " dn ;[disabled for debugging]
transmit "LD 20^M"
waitfor "REQ"
transmit "PRT^M"
waitfor "TYPE: "
transmit "DNB^M"
waitfor "CUST "
transmit "0^M"
waitfor "DN "
transmit dn
transmit "^M"
waitfor "DATE "
transmit "^M"
waitfor "PAGE "
transmit "^M"
waitfor "DES "
transmit "^M"
waitfor "NACT "
transmit "^M"
endproc
Proc TNextract
; while marpnotfound = 1
; usermsg "starting TNextract"
waitfor "TN" ;looking for the lines with the TN in them [THIS WAITFOR NEVER TRIGGERS]
rget readline ;read the rest of the line
usermsg "here's the line %20.10s" readline
substr isthisthemarp readline 25 4 ;does this line have MARP in it?
IF strcmp isthisthemarp marp ;if this is the MARP entry
usermsg "this is the MARP"
substr TN readline 4 11 ;extract the TN
usermsg "the TN is %s" TN
MarpNotFound=0 ;get out of the WHILE DO since we've found it.
endif
; endwhile
endproc
Unfortunately, the WAITFOR in procedure TNextract never triggers. Any suggestions on what I'm doing wrong?
Here's the printout that the script will see:
REQ: PRT - these responses are ented by the script
TYPE: DNB
MARP NOT ACTIVATED
CUST 0
DN 2233
DATE
PAGE
DES
- response from PBX starts here
DN 2233
CPND
NAME John Smith
XPLN 13
DISPLAY_FMT FIRST,LAST
TYPE SL1
TN 036 0 06 01 KEY 00 H MARP DES PR5562 9 OCT 2006
(3904)
-response ends here
The line that starts with TN is where I want to start analyzing what comes in from the PBX. I'm using a WAITFOR to watch for the TN entry and then using an RGET to read the rest of the line. I may need to have multiple such lines read as I'm looking for the line with the entry MARP in it.
Here's the script so far...
string dn="2233", tn, readline, isthisthemarp, marp="marp"
integer marpnotfound=1
proc main
set txpace 50
call FindDN
call TNextract
; call OutTN [disabled for debugging]
set txpace 0
endproc
Proc FindDN
; SDLGINPUT "DN entry" "Please enter the number you want to look up " dn ;[disabled for debugging]
transmit "LD 20^M"
waitfor "REQ"
transmit "PRT^M"
waitfor "TYPE: "
transmit "DNB^M"
waitfor "CUST "
transmit "0^M"
waitfor "DN "
transmit dn
transmit "^M"
waitfor "DATE "
transmit "^M"
waitfor "PAGE "
transmit "^M"
waitfor "DES "
transmit "^M"
waitfor "NACT "
transmit "^M"
endproc
Proc TNextract
; while marpnotfound = 1
; usermsg "starting TNextract"
waitfor "TN" ;looking for the lines with the TN in them [THIS WAITFOR NEVER TRIGGERS]
rget readline ;read the rest of the line
usermsg "here's the line %20.10s" readline
substr isthisthemarp readline 25 4 ;does this line have MARP in it?
IF strcmp isthisthemarp marp ;if this is the MARP entry
usermsg "this is the MARP"
substr TN readline 4 11 ;extract the TN
usermsg "the TN is %s" TN
MarpNotFound=0 ;get out of the WHILE DO since we've found it.
endif
; endwhile
endproc
Unfortunately, the WAITFOR in procedure TNextract never triggers. Any suggestions on what I'm doing wrong?