views:

70

answers:

1

I have a windows mobile 6 application using TAPI 2.0. lineGetAddressID() is needed to get the address identifier used by several calls in the telephone api, but I can't get it to work.

I have tried the following to no avail:

HLINE line; // valid handle from lineOpen();
DWORD addr_id = 0;
result = ::lineGetAddressID( line, &addr_id, LINEADDRESSMODE_DIALABLEADDR, L"1234", 5 );
result = ::lineGetAddressID( line, &addr_id, LINEADDRESSMODE_DIALABLEADDR, L"5551234", 8 );
result = ::lineGetAddressID( line, &addr_id, LINEADDRESSMODE_DIALABLEADDR, L"1115551234", 11 );
result = ::lineGetAddressID( line, &addr_id, LINEADDRESSMODE_DIALABLEADDR, L"11115551234", 12 );

All of them return LINEERR_INVALADDRESS. Can anybody point out what I may be doing wrong?

As a side question, how can I programmaticly get the address? It appears in the LINEADDRESSCAPS structure returned by lineGetAddressCaps(), but that requires an address identifier (which would need to come from lineGetAddressID(), which requires an address...).

Note: I realize I could use 0 as the address ID and it will probably work, but I have no guarantee it will work for every platform. I would like to get this solved 'right'.

Thanks, PaulH

A: 

When you invoke lineGetDevCaps one of the members of the LINEDEVCAPS structure, dwNumAddresses, is a count of the number of addresses associated with the line device.

TAPI states that the value of address identifiers are defined as the following:

Address identifiers range from zero to one less than the value indicated by dwNumAddresses.

So you can iterate through each address identifier value in the range [0 .. (dwNumAddresses - 1)] and invoke lineGetAddressCaps as you have provided a valid address identifier. There is no need to use lineGetAddressID in this case as the address identifier is known and valid.

If you do this, do any of the addresses specified in the LINEADDRESSCAPS structure match the string being used in your calls to lineGetAddressID? Noting that your application is configured to use Unicode rather than ANSI.

Henk
Each line device has `dwNumAddresses == 1`. In the `LINEADDRESSCAPS` structure, though `dwAddressSize == 0`.
PaulH
When you invoke `lineGetAddressCaps` what is the return value? Is it `LINEERR_STRUCTURETOOSMALL`? This may explain why the `dwAddressSize` value is 0.
Henk
The return value is 0. Other values in there are populated (eg dwAddressFeatures, dwDeviceClassesSize/Offset, dwAddrCapFlags, etc...), but not dwAddressSize.
PaulH