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