AI, engineering

I Couldn't Call China, So I Built an AI That Could

My Mandarin was never going to book the restaurants I wanted in China. They take reservations by phone only, in Chinese. So I built a Mandarin-speaking AI that could call them for me. Here is how it all came together: the whole pipeline, plus four real booking conversations, transcribed in Chinese and English.

A build log with real call transcripts. Everything is exactly what happened.

The booking call, all 1:48 of it. Full transcripts are in section 06.

The short version

01The problem

This started with a trip to China and a list of restaurants I really wanted to eat at. My Mandarin was never going to book them. I am learning the language, and I can get through the basics, but the restaurants I wanted, in Shanghai and Beijing, were never going to be booked with the basics.

Restaurants at this level in China do not take bookings any other way than by phone. There is no online reservation form, no app that covers them, no email address that gets answered. Their listing pages just show a phone number. The reservation book lives with whoever answers that landline, and if you do not call, you do not have a table.

And the call is only the start of what has to happen by phone. The minimum spend, the deposit, the set menus, the pre-orders: all of it gets negotiated on that call, or it does not happen. One dish on this trip, a 28-day baby Peking duck, is pre-order only and served at exactly one branch; the only way to get one is to phone ahead and ask. The menus and the deposit money get coordinated over WeChat afterwards, but only once the call has happened. All of it runs in Mandarin, during the restaurant's service hours, which from California means the middle of the night, on lines that are busy half the time. A negotiation like this, with a name spelled out letter by letter and deposit terms confirmed out loud, needs real Chinese.

So I decided to have an AI make the call. That plan ran into a wall almost immediately. My US voice provider, Twilio, handles my calls, texts, and one-time codes, and it is rock solid, but it does not do outbound voice calls to mainland China. Not "it's expensive." Not "it's in beta." It just doesn't. I needed a carrier that could actually put a call through to China, which meant Telnyx, plus an identity check before they would unlock +86.

So I built a second lane, China-only, with an AI doing the talking. Here is exactly how a call travels.

CHINA LANE US LANE Booking request Dec 13 · 6:30 PM · party of 4 API ElevenLabs Mandarin voice agent · brain + voice SIP INVITE SIP trunk "ElevenLabs AI Voice" · :5060 · TCP trunk terminates Telnyx KYC verified · $5 credit · US caller ID PSTN Restaurant landline Shanghai · a person answers Table for 4 confirmed · no deposit · full transcript below My apps alerts · one-time codes · orders API Twilio US/Canada lane · voice + SMS PSTN US phones texts, codes and alerts delivered Twilio has no +86 voice path, so China runs on the left lane.
Two lanes. Twilio handles the US side and never touches China. The China lane goes ElevenLabs → SIP trunk → Telnyx → the phone network → the restaurant.

02Follow a call, hop by hop

Every booking is five hops. Swipe or tap through and watch a call travel from a prompt to a landline in Shanghai.

Five hops, about two minutes, one dinner table. Hop detail is the cost or the config at each step.

03Two lanes

Twilio didn't get fired. It just doesn't go to China. So now there are two lanes, each doing what it's good at:

Twilio

The home lane · US + Canada
  • Domestic voice calls
  • SMS and one-time codes
  • Build and alert notifications
  • Cannot call mainland China, at any price

Telnyx

The China lane · +86 unlocked
  • Outbound voice to mainland China
  • SIP trunk friendly, plays nice with ElevenLabs
  • Needed ID verification (KYC) to unlock the +86 country
  • $5 credit to start, $1 number ($1/month)

04Placing a call

One API call starts everything. You hand ElevenLabs three things: which agent talks, which phone identity it calls from (the SIP trunk), and the destination number. ElevenLabs opens the trunk to Telnyx, Telnyx dials out, and the agent starts talking when a human picks up.

const res = await fetch(
  "https://api.elevenlabs.io/v1/convai/sip-trunk/outbound-call",
  {
    method: "POST",
    headers: {
      // placeholder: use a real key from your ElevenLabs dashboard
      "xi-api-key": "ELEVENLABS_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      agent_id: "agent_xxxx",              // the Mandarin booking agent
      agent_phone_number_id: "phnum_xxxx", // the SIP trunk identity
      to_number: "+8621xxxxxxxx"           // the restaurant, E.164 format
    })
  }
);
const call = await res.json();
// poll GET /v1/convai/conversations/{conversation_id}
// until the call completes, then read the transcript

If the line is busy, the network answers with SIP 486 and the API reports a failure. The fix is boring and effective: schedule retries 20 minutes apart and try again. One Beijing restaurant's line came back busy twice in a row, so the retry job just waits and redials.

05The prompt is the product

The voice is ElevenLabs. The manners are a prompt. The agent opens with one neutral line: “您好,请问是…餐厅吗?我想订个位子。” (Hello, is this … restaurant? I'd like to book a table.) That's the whole introduction. It never claims to be the guest. It never says the word AI. If the restaurant asks who is calling, it says it's the guest's assistant, and only then. It gives the guest's name only when asked for the booking name.

Honest footnote: the first version of the prompt had the agent introduce itself as "an AI assistant." You can hear it in the first transcript below, because that is what actually happened. It was rewritten to the neutral version right after that call. The lesson stuck: the prompt is the product. Nobody on the other end of a restaurant line needs a vocabulary lesson about artificial intelligence. They need a table for four.

06The calls

All four calls below are real, placed through the pipeline above and transcribed word for word. Each line shows the original Chinese first, then the English. The first two calls are one Shanghai dinner: the booking, then its confirmation. The second two are a Beijing three-star: the booking, then a follow-up call to pre-order the one dish that cannot be ordered on the night. Redactions: [guest name], [phone number], [restaurant], and [WeChat ID] stand in for the real values, and on the Beijing calls the dates are redacted too. Everything else is exactly what was said. The actual audio recordings are attached inside each card, PII redacted.

What happened: the agent asked for 7:30 PM (full), then 8:00 PM (full). The restaurant said tables free up after 9 PM, so the agent took 9:30 PM for 4. The restaurant stated a ¥500 per person minimum spend, took the phone number, and confirmed with “确认了” (confirmed). No deposit.

Listen to the actual call, PII meowed over:

Agent您好,请问是[restaurant]餐厅吗?我是[guest name]先生的一位AI助手,我帮他打电话来订位。Hello, is this [restaurant]? I'm [guest name]'s AI assistant, calling to book a table for him.
Restaurant你好。Hello.
Agent您好,我想帮[guest name]先生预订本周日,也就是十二月六号晚上七点半的晚餐位置,一共四位。请问这个时间还有空位吗?Hi, I'd like to book dinner for [guest name] this Sunday, December 6th, at 7:30 PM, party of 4. Do you have any tables at that time?
Restaurant没有了。No more.
Agent没关系,那请问晚上八点还有空位吗?如果八点也没有,麻烦您告诉我周日晚上还有哪些时间段可以预订。No problem. What about 8:00 PM? If 8 is also full, could you tell me what times are still available Sunday evening?
Restaurant几位?How many people?
Agent一共是四位客人。请问周日晚上八…Four guests total. Do you have anything Sunday evening at 8…
Restaurant九点钟以后。After 9 o'clock.
Agent好的,明白了,那就是九点以后才有空位。那麻烦您帮我们要一个九点整的四人桌,还是九点半比较合适呢?Got it, so tables only after 9. Should I book a table for 4 at 9:00 sharp, or is 9:30 better?
Restaurant九点半。9:30.
Agent好的,那就预订本周日十二月六号晚上九点半,四位,名字是[guest name]。请问您能确认一下预订成功了吗?有没有预订编号或者需要我们注意的事项?OK, then: this Sunday, December 6th, 9:30 PM, 4 people, name is [guest name]. Could you confirm the booking went through? Is there a confirmation number or anything we should know?
Restaurant最低消费是500块一位,然后手机号码麻烦你提供。Minimum spend is 500 per person, and please give me a mobile number.
Agent好的,我记下了每位最低消费五百元的规定。关于联系电话,号码是[phone number]。请问预订确认了吗?Noted, 500 minimum per person. For the contact number: [phone number]. Is the booking confirmed?
Restaurant确认了。Confirmed.
Agent太好了,非常感谢您的确认。我会把最低消费标准和预订时间转告给[guest name]先生。如果后续需要支付定金,请告诉我们具体的支付方式,[guest name]先生会亲自安排。再次感谢您的帮助,祝您晚上愉快!Wonderful, thank you for confirming. I'll pass the minimum spend and the booking time to [guest name]. If a deposit is needed later, tell us the payment method and [guest name] will arrange it himself. Thanks again for your help, have a great evening!

One agent turn was truncated in the call log and is shown as it appears. This call used the original prompt, which is why the agent introduces itself as an AI assistant. See section 05.

What happened: the agent called back to verify the booking is in the restaurant's system, confirmed the name and phone number on file are correct, and asked if the restaurant needs anything else. Answer: no deposit needed (“不用,不用付定金”).

Listen to the actual call, PII meowed over:

Agent您好,请问是[restaurant]吗?我想确认一下之前订的位子。Hello, is this [restaurant]? I'd like to confirm a reservation I made earlier.
Restaurant你好。Hello.
Agent您好,我是[guest name]先生的助理,打电话来确认一下他预订的位子。预订信息是2026年12月6日星期日,晚上9点半,一共4位,姓名是[guest name]。麻烦您帮我在系统里查一下,顺便核对一下预留的联系电话是否正确,号码是[phone number]。Hi, I'm [guest name]'s assistant, calling to confirm his reservation. The booking is for Sunday, December 6, 2026, at 9:30 PM, party of 4, under the name [guest name]. Could you please check your system and also verify the contact phone number on file? The number is [phone number].
Restaurant麻烦你再重复一下日期。Could you repeat the date, please?
Agent没问题,我再重复一遍日期。预订时间是2026年12月6日,星期日,晚上9点半。Of course, the date again: December 6, 2026, Sunday, 9:30 PM.
Restaurant是的。Yes.
Agent好的,那麻烦您确认一下系统里是否有这个预订,姓名和刚才报的电话号码是否正确?另外请问还需要我们提供什么信息吗,比如定金或者具体的到店时间?Great. Could you confirm the reservation is in your system, and that the name and phone number I just gave are correct? Also, is there anything else you need from us, like a deposit or a specific arrival time?
Restaurant麻烦你再重复一下客人的名字。Could you repeat the guest's name, please?
Agent好的,客人的名字是[guest name],[spells out the guest's name character by character]。麻烦您再核对一下系统里的记录。Sure. The guest's name is [guest name] [spells out the guest's name character by character]. Please double-check it against your records.
Restaurant有的。We have it.
Agent太好了,确认有预订我们就放心了。那请问预留的联系电话[phone number]在系统里也是正确的吗?Wonderful, glad to hear the reservation is confirmed. Is the phone number on file, [phone number], also correct?
Restaurant正确的。Correct.
Agent太好了,信息都核对无误,非常感谢您的配合。请问还需要我们提前准备什么吗,比如支付定金或者注意具体的到店时间?Perfect, everything checks out. Thank you so much for your help. Is there anything we should prepare in advance, like paying a deposit or a specific arrival time to keep in mind?
Restaurant不用,不用付定金。No need, no deposit required.
Agent好的,明白了,不需要付定金。那我们到时候会准时带客人过去,再次感谢您的确认,祝您生意兴隆,再见。Understood, no deposit needed. We'll bring our guests on time. Thanks again for confirming, wishing you great business, goodbye.

This call used the rewritten neutral prompt: no AI mention, no self-introduction, just the booking.

What happened: a second restaurant, this time a three-star in Beijing, and the hardest table of the trip. The agent booked the main hall at 6:30 PM for 4 adults. The restaurant echoed every detail back and confirmed. They asked for the guest's WeChat to coordinate the deposit and menus ahead of time; the agent deferred, and the guest messaged the restaurant himself afterward.

Listen to the actual call, PII silenced:

Agent您好,请问是[restaurant]吗?Hello, is this [restaurant]?
Restaurant是的先生,[restaurant]。Yes sir, this is [restaurant].
Agent您好,我想帮[guest name]先生预订[date]晚上六点半的晚餐,一共四位。Hi, I'd like to book dinner for [guest name] on [date] at 6:30 PM, party of 4.
Restaurant[date]。[date].
Agent是的…Yes…
Restaurant[date]晚上。The evening of [date].
Agent对的…That's right…
Restaurant好。OK.
Agent请问晚上六点半还有四位的位置吗?Do you have a table for 4 at 6:30 PM?
Restaurant呃……您四位用户还有小朋友一起过来吗?Uh… will there be any children coming with your party of four?
Agent没有小朋友,四位都是成人。No children, all four are adults.
Restaurant好的。OK.
Agent那…Then…
Restaurant大厅可以安排的。We can arrange the main hall.
Agent好的,那就预订大厅晚上六点半的位置。Great, let's book the main hall at 6:30 PM.
Restaurant好的,客人怎么称呼呢?OK, what is the guest's name?
Agent预订姓名是[guest name]。The booking name is [guest name].
Restaurant…[guest name]先生。…[guest name], got it.
Agent是的,[guest name]。联系电话…Yes, [guest name]. The contact number…
Restaurant好的,上面留一…OK, I'll put down a…
Agent联系电话是[phone number]。The contact number is [phone number].
Restaurant好的,有微信吗?因为要提前对接定金和菜单。OK. Do you have WeChat? We need to coordinate the deposit and the menus in advance.
Agent微信暂时不方便提供,关于定金和菜单的对接,我会亲自安排处理,稍后让[guest name]先生直接联系您确认细节。WeChat is not convenient to share right now. For the deposit and menus, I will arrange it personally, and have [guest name] contact you directly to confirm the details.
Restaurant好的。OK.
Agent那麻烦您确认一下,[date]晚上六点半,四位成人的大厅位置,预订人是[guest name],对吗?Could you confirm: [date], 6:30 PM, main hall, 4 adults, booking name [guest name]. Is that right?
Restaurant对,是的,没错。Yes, that's right, correct.
Agent好的,那就确认预订成功了,感谢您的安排,再见。Great, the booking is confirmed then. Thank you for arranging it, goodbye.
Restaurant嗯,好的。Mm, OK.
Agent那就不…Then I'll let you…
Restaurant嗯嗯。Mm-hmm.
Agent好的,那就这样,祝您晚上愉快,再见。OK, that's all. Have a pleasant evening, goodbye.

Dates are redacted on the Beijing calls. This agent passed on sharing the guest's WeChat, which is why the guest messaged the restaurant himself that night, and why the next call had a WeChat record to check.

What happened: the follow-up call, and the fiddliest one yet. The agent reconfirmed the Beijing table, pre-ordered the 28-day baby Peking duck (only this branch serves it, and only by pre-order), and asked the restaurant to read back the WeChat ID they had on file. It was wrong. The agent spelled out the correct ID letter by letter and had them read it back right. Then it collected the set menu tiers (¥1,280, ¥1,980, and ¥2,580 per person; the dish lists come from the butler over WeChat) and the deposit terms: ¥1,000 for the hall, due 24 hours ahead, fully refundable with 24 hours notice, and no separate deposit for the duck. The agent paid nothing. Money is always the guest's decision.

Listen to the actual call, PII silenced:

Agent您好,我想跟进一下[date]晚上6点半、4位、[guest name]名下的订位。Hello, I'd like to follow up on a reservation on [date] at 6:30 PM, party of 4, under [guest name].
Restaurant呃……[date],呃……多少号先生?Uh… [date]… which day was it, sir?
Agent是[date],晚上6点半,4位,预留姓名是[guest name]。It's [date], 6:30 PM, party of 4, under the name [guest name].
Restaurant好的,请稍等,帮你查一下。OK, one moment, I'll check for you.
Agent好的,麻烦您了,我在线等。Thanks, I'll hold.
Restaurant……
Agent您好,您还在吗?需要我重复…Hello, are you still there? Should I repeat…
Restaurant你好,在的。有客人的预订,4位用餐,已经登记好的。Hello, I'm here. There is a reservation for this guest, 4 diners, already registered.
Agent好的,确认订位无误。另外想为这顿…Good, the reservation checks out. I'd also like to, for this…
Restaurant是的。Yes.
Agent好的,确认订位无误。另外想为这顿晚餐预订贵店的28天小种北京烤鸭,就是[restaurant]专供的那款,请问可以预订吗?Good, the reservation checks out. I'd also like to pre-order your 28-day baby Peking duck for this dinner, the one exclusive to this branch. Can I reserve one?
Restaurant好的,可以预定的,我帮你留好了。Sure, it can be pre-ordered. I've set one aside for you.
Agent太好了,烤鸭已帮您留好。另外,[guest name]先生之前加了餐厅微信并留过言,想跟您核对一下,您那边记录的微信号是多少?麻烦您念出来,我确认一下是否一致。Wonderful, the duck is set aside. One more thing: [guest name] added the restaurant on WeChat earlier and left a message. I'd like to verify the WeChat ID you have on record. Could you read it out so I can check it matches?
Restaurant[WeChat ID on file]…[WeChat ID on file]…
Agent……
Restaurant…[rest of the ID]。…[rest of the ID].
Agent您刚才念的是[the ID on file],这不对,应该是[one letter different]。正确的微信号是:[spells out the correct WeChat ID letter by letter]。麻烦您再核对一下,看是否已经记下了正确的号码?What you read out was [the ID on file]. That's not right; it should be [one letter different]. The correct WeChat ID is: [spells it out letter by letter]. Could you check again and confirm you have the correct one now?
Restaurant[reads the ID back, part 1]。[reads the ID back].
Agent对…Right…
Restaurant[reads the ID back, part 2]。[reads the ID back].
Agent对…Right…
Restaurant[reads the ID back, part 3]。[reads the ID back].
Agent没错,完全正确。既然微信已经核对无误,那想请教一下店里目前的套餐情况,具体有哪几种、每位多少钱,以及大致包含哪些招牌菜?Exactly right. With WeChat verified, could I ask about your current set menus: how many are there, what does each cost per person, and roughly which signature dishes do they include?
Restaurant1280一位,1980一位,2580一位。1,280 per person, 1,980 per person, 2,580 per person.
Agent好的,记下了,有一千二百八十、一千九百八十和两千五百八十元这三种价位。请问这三种套餐分别大致包含哪些招牌菜呢?另外,预订烤鸭或保留这个位子需要支付订金吗?Noted: 1,280, 1,980, and 2,580 yuan. Which signature dishes does each set roughly include? Also, is a deposit required for the duck pre-order or to hold this table?
Restaurant需要支付订金,后续管家会在微信上给你发一下菜单的详细内容,到了[date]会有更新。A deposit is required. The butler will send the detailed menus over WeChat later, and the menus get refreshed closer to the date.
Agent好的,明白菜单细节后续会在微信沟通。那关于订金,请问具体金额是多少?可以通过微信转账还是…OK, menu details over WeChat later. About the deposit: how much is it exactly? Can it be paid by WeChat transfer, or…
Restaurant大拼。[unclear in the log]
Agent抱歉,您刚才说的“大拼”是指订金金额吗?还是指烤鸭的规格?我想确认一下订金…Sorry, was that about the deposit amount, or the duck's size? I want to confirm the deposit…
Restaurant大厅的位置是收取您1,000元,如果取消位置提前24小时告知可以原路退回,微信和支付宝都方便的。管家会给客人发小程序或者公司二维码。For a main hall table we charge 1,000 yuan. If you cancel at least 24 hours ahead, it is refunded to the original payment route. WeChat and Alipay both work. The butler will send the guest a mini-program or the company QR code.
Agent好的,记下了,大厅订位订金是一千元,支持微信或支付宝,取消需提前二十四小时通知。请问最晚需要在什么时间前完成支付?另外,预订那只…Noted: a 1,000 yuan deposit for the hall, WeChat or Alipay, cancel at least 24 hours ahead. By when must the payment be completed at the latest? Also, for the duck…
Restaurant提前24小时。24 hours in advance.
Agent好的,明白最晚支付时间是提前二十四小时。那预订那只28天小种北京烤鸭,是否也需要单独支付订金呢?如果没有其他…Got it, payment at least 24 hours ahead. Does the 28-day baby duck pre-order need a separate deposit? If there's nothing else…
Restaurant不需要的。No, it doesn't.
Agent好的,确认烤鸭无需额外订金。那所有事项都已核对清楚,感谢您的配合,稍后请管家在微信上联系即可,再见。Good, no extra deposit for the duck. Everything is checked then. Thank you for your help; the butler can reach out on WeChat. Goodbye.
Restaurant好的。OK.
Agent好的,那就不打扰您了,感谢…OK, I won't keep you. Thank you…

A few agent turns were cut off mid-sentence in the call log and are shown as they appear; delivery tags in the log were removed. The agent collected the deposit terms and paid nothing. Money is always the guest's call.

07What it costs

The full bill for a China-capable calling lane:

Per call

ElevenLabs
  • Roughly 700 to 850 credits for a two minute call
  • The longest call so far, the four minute duck follow-up, ran 1,727 credits
  • That covers the voice, the language model, and the phone time

One time setup

Telnyx
  • $5 of account credit to fund the account
  • $1 for the US number, then $1/month
  • ID verification (KYC): free, just paperwork

Total damage so far: about $7 in actual money. That is the Telnyx credit and the number. ElevenLabs has cost $0, because every call in this post ran on the free plan's monthly credits.

And what would 10,000 calls look like? Scale the four calls above up and the numbers stay almost silly. Mine averaged about 2.5 minutes and about 1,000 credits each, roughly 420 credits a minute. So 10,000 calls is about 25,000 minutes on the phone, around 420 hours of Mandarin negotiation, and about 10 million credits.

On the free plan's 10,000 credits a month, the same 10,000 calls would take about 83 years. The human version is not much faster: 420 hours of talking is three months of full-time phone work, before the busy signals, the retries spaced 20 minutes apart, and the fact that Beijing dinner service runs at 3 AM California time. A bilingual assistant at $25 an hour runs past $10,000 and still cannot be awake for all of it. The pipeline does not care what time it is.

The alternative was me calling in my beginner Mandarin, which would have cost nothing and accomplished less. For about seven dollars plus AI credits, I now have a Mandarin-speaking assistant that books tables across the Pacific while I sleep. That is a trade I will make every time.

08Keep exploring

09Built with

TAGS: AI, ENGINEERING