Callerid / auth error / multiple SIP accounts

Hi, there is something i don’t understand about sip channels using callerids.

My sip.conf contains a dialout sip context like this:

[sip1] type = friend contex = sipin fromdomain = ..... ; FQDN of my asterisk server, not NAT'ed secret = ..... host = cc-connect.pbx-network.de canrenvite = yes insecure = very qualify = yes nat = no username = 1234567 ; replacement for my sip accountid authuser = 1234567

When I dialout everything works fine, als long as I don’t set the callerid in my dialplan and use only one SIP account. I’ve got registered CLIP numbers which i want to set dynamically depending on the dialed extension, and it seems that the above config works right now.

However, I need about 100 concurrent lines. If i setup a second sip account (with different accountid), or -generally spoken- more than one account, the authentication fails with a 403 forbidden, even though I set the authuser params correctly.

What’s going on there, how can i set the callerid so that the sip protocol sends it like “from: callerid callerid@fqdn” AND authorizes correctly with my SIP Provider using my accountid? There are a lot of examples over there, but none is working!

If i set the fromuser param, then my callerid setting is ignored, but dialout is working on multiple channels. If I use type=peer instead of type=friend, then I always get a 403 forbidden whenever i send a callerid different than my sip accountid. Why does the type param affect the way asterisk authorizes with its sip peers?

At the moment I think about using 300 SIP accounts, 100 for each required callerid. But this can’t be the answer…

Sorry for my englisch, I hope someone does understand my problem and has any hints for me.

Thanks a lot,
Andy