关于TAPI控制电话的问题(100分)

  • 主题发起人 主题发起人 duanbukui
  • 开始时间 开始时间
D

duanbukui

Unregistered / Unconfirmed
GUEST, unregistred user!
我在使用lineForward转接电话时老是返回无效的参数<br>不知道有哪位大哥做过这方面的开发,还请多多指点。<br>function TPhoneControl.LlineForward(LineDev: TLineInfo;<br> &nbsp;TargetAddr: PChar): Boolean;<br>var<br> &nbsp; &nbsp;Msg : PChar ;<br> &nbsp; &nbsp;Rs &nbsp;: LongInt ;<br> &nbsp; &nbsp;lpForWardList : TLineForwardList ;<br> &nbsp; &nbsp;lphConsultCall : THCall ;<br> &nbsp; &nbsp;CallerAddr : PChar ;<br> &nbsp; &nbsp;lpCallParams : LPLineCallParams ;<br> &nbsp; &nbsp;OffSet : DWORD ;<br>begin<br> &nbsp; &nbsp;// 转接电话<br> &nbsp; &nbsp;Result := False ;<br> &nbsp; &nbsp;try<br> &nbsp; &nbsp; &nbsp; &nbsp;// 设置权限<br> &nbsp; &nbsp; &nbsp; &nbsp;if not LlineSetCallPrivilege(LineDev,2,True) then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Exit ;<br> &nbsp; &nbsp; &nbsp; &nbsp;// 设置转接电话的参数<br> &nbsp; &nbsp; &nbsp; &nbsp;lpForWardList.dwTotalSize := SizeOf(TLineForwardList) + StrucAddSize ;<br> &nbsp; &nbsp; &nbsp; &nbsp;lpForWardList.dwNumEntries := 1 ;<br> &nbsp; &nbsp; &nbsp; &nbsp;lpForWardList.dwLineForward[0].dwForwardMode := &nbsp;LINEFORWARDMODE_UNCOND ;<br> &nbsp; &nbsp; &nbsp; &nbsp;CallerAddr := '86053283008220' ;<br> &nbsp; &nbsp; &nbsp; &nbsp;lpForWardList.dwLineForward[0].dwCallerAddressSize := SizeOf(CallerAddr) + 1 ;<br> &nbsp; &nbsp; &nbsp; &nbsp;OffSet := sizeof(TLineForwardList) ;//+ StrucAddSize;<br> &nbsp; &nbsp; &nbsp; &nbsp;CopyMemory(@OffSet,CallerAddr,SizeOf(CallerAddr)) ;<br><br> &nbsp; &nbsp; &nbsp; &nbsp;OffSet := SizeOf(OffSet) + 1 ;<br> &nbsp; &nbsp; &nbsp; &nbsp;lpForWardList.dwLineForward[0].dwCallerAddressOffset := OffSet ;<br> &nbsp; &nbsp; &nbsp; &nbsp;lpForWardList.dwLineForward[0].dwDestCountryCode := 86 ;<br> &nbsp; &nbsp; &nbsp; &nbsp;lpForWardList.dwLineForward[0].dwDestAddressSize := SizeOf(TarGetAddr) &nbsp;+ 1 ;<br> &nbsp; &nbsp; &nbsp; &nbsp;OffSet := sizeof(TLineForwardList) + StrucAddSize ;<br> &nbsp; &nbsp; &nbsp; &nbsp;CopyMemory(@OffSet,TarGetAddr,SizeOf(TarGetAddr)) ;<br><br> &nbsp; &nbsp; &nbsp; &nbsp;OffSet := SizeOf(OffSet) + 1 ;<br> &nbsp; &nbsp; &nbsp; &nbsp;lpForWardList.dwLineForward[0].dwDestAddressOffset := OffSet ;<br> &nbsp; &nbsp; &nbsp; &nbsp;GetMem(lpCallParams,SizeOf(TLineCallParams) + StrucAddSize) ;<br> &nbsp; &nbsp; &nbsp; &nbsp;FillChar(lpCallParams^,SizeOf(TLineCallParams) + StrucAddSize,0) ;<br> &nbsp; &nbsp; &nbsp; &nbsp;lpCallParams.dwTotalSize := SizeOf(TLineCallParams) + StrucAddSize ;<br> &nbsp; &nbsp; &nbsp; &nbsp;lpCallParams.dwMediaMode := 1 ;<br><br> &nbsp; &nbsp; &nbsp; &nbsp;Rs := lineForward(LineDev.Line,1,0,lpForwardList,3,lphConsultCall,lpCallParams) ;<br> &nbsp; &nbsp; &nbsp; &nbsp;Case Rs of<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LINEERR_INVALLINEHANDLE &nbsp; &nbsp; : Msg := Err_INVALLINEHANDLE ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LINEERR_NOMEM &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Msg := Err_NOMEM ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LINEERR_INVALADDRESSID &nbsp; &nbsp; &nbsp;: Msg := Err_INVALADDRESSID ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LINEERR_OPERATIONUNAVAIL &nbsp; &nbsp;: Msg := Err_OPERATIONUNAVAIL ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LINEERR_INVALADDRESS &nbsp; &nbsp; &nbsp; &nbsp;: Msg := Err_INVALADDRESS ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LINEERR_OPERATIONFAILED &nbsp; &nbsp; : Msg := Err_OPERATIONFAILED ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LINEERR_INVALCOUNTRYCODE &nbsp; &nbsp;: Msg := Err_INVALCOUNTRYCODE ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LINEERR_RESOURCEUNAVAIL &nbsp; &nbsp; : Msg := Err_RESOURCEUNAVAIL ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LINEERR_INVALPOINTER &nbsp; &nbsp; &nbsp; &nbsp;: Msg := Err_INVALPOINTER ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LINEERR_STRUCTURETOOSMALL &nbsp; : Msg := Err_STRUCTURETOOSMALL ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LINEERR_INVALPARAM &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Msg := Err_INVALPARAM ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LINEERR_UNINITIALIZED &nbsp; &nbsp; &nbsp; : Msg := Err_UNINITIALIZED ;<br> &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp;if Rs &lt; 0 then<br> &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Msg := PChar('lineForward:[' + String(Msg) +']线路ID[' + &nbsp;IntToStr(LineDev.LineNo) + ']lphConsultCall[' + IntToSTr(lphConsultCall) + ']') ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 发送错误消息,错误代码为wParam,相关说明为lParam 参数<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SendMessage(ExeApp,WM_TAPIProcErr,Rs,lParam(Msg)) ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Exit ;<br> &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp;except<br> &nbsp; &nbsp; &nbsp; &nbsp;Exit ;<br> &nbsp; &nbsp;end;<br> &nbsp; &nbsp;Result := True ;<br>end;<br><br>欢迎加入 14053856 群讨论<br>也可加QQ 10615298 单聊 :)
 
后退
顶部